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

 

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

the whole blesta uses h2o.

 

That is not true .

 

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 .

 

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

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

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 .

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...