Jump to content
  • 0

Add Javascript To The Cms Break The Page


Question

Posted

i want to add a simple javascript in the cms page . but i get a error 

unexpected character in filters : "(" at 8804 on line 233 in /home/ccccccc/public_html/blesta/vendors/h2o/h2o/parser.php

how i can post javascript to the cms page ?

        <script type="text/javascript">
            $(document).ready(function() {
                get_data();
            });
            
            function get_data() {
                $(this).blestaRequest("GET", "/blesta/plugin/data/get_data/", null, function(data) {
                    if (data)
                        $(".replaceer_box").html(data);
                },
                null,
                {dataType:"json"});
            }
        </script>

the error not in the admin side . error in client page view .

9 answers to this question

Recommended Posts

  • 0
Posted

Someone asked me about this the other day. Here is my response:

The Portal plugin is not intended to support JavaScript from its input
in the UI. JavaScript conflicts with the H2o parser for tag replacement
because it contains braces (i.e. { and }).

If you would like to set that JavaScript to the portal, it would be
better to set it in the template that displays the portal instead. You
can find that template at /plugins/cms/views/default/main.pdt.

Since it's a core change, you should probably make a note of the fact a 
core file has been changed.

You can use vQmod to perform 'virtual' changes to the core without making 
real core file modifications. However, if the file gets updated in the 
future such that your custom vQmod change no longer applies, you would 
need to re-add your custom change with a new vQmod addition. 
  • 0
Posted

OR 

 

put your code in a js file , and the call it by

<script src="blesta/path_to_your_js_file/file.js"></script>

that way i use it and it work like a charm .

 

NOTE : is a pain that CMS plugin is limited by a third party helper .

  • 0
Posted
  On 9/5/2015 at 12:59 AM, naja7host said:

 

NOTE : is a pain that CMS plugin is limited by a third party helper .

 

Why? the whole blesta uses h2o, why stop on one plugin because you don't want to be limited because of h2o? why not ask them to make a js tag?

  • 0
Posted
  On 9/5/2015 at 7:06 AM, Licensecart said:

the whole blesta uses h2o.

 

That is not true .

 

  On 9/5/2015 at 7:06 AM, Licensecart said:

why stop on one plugin because you don't want to be limited because of h2o?

 

i wil not stop , i just ask and give my opinion .

 

  On 9/5/2015 at 7:06 AM, Licensecart said:

why not ask them to make a js tag?

 

if i will use it in my script i wil ask them . here blesta who shoud ask them .

  • 0
Posted
  On 9/5/2015 at 9:52 PM, naja7host said:

 

That is not true .

 

It is true though from the portal to emails to even plugins they all use h2o, {% if ….. %} {% /if %} etc is all the h2o..

  • 0
Posted

H2o is used in locations where tag replacement can occur, but obviously this does not occur for every input field.

 

Another possible work-around to the JS problem is to update the parser options Blesta defines for H2o in the config by changing the expected syntax characters (i.e. { and }) to something else, and subsequently updating each place that tag is used (e.g. email templates, portal, etc.) in Blesta.

  • 0
Posted
  On 9/5/2015 at 11:58 PM, Tyson said:

Another possible work-around to the JS problem is to update the parser options Blesta defines for H2o in the config by changing the expected syntax characters (i.e. { and }) to something else, and subsequently updating each place that tag is used (e.g. email templates, portal, etc.) in Blesta.

 

Sound very good option .

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...