ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Template parser is changing my Javascript

April 21, 2012 8:21am

Subscribe [2]
  • #1 / Apr 21, 2012 8:21am

    RevaCo

    240 posts

    Hello,

    I have protect_javascript config var set to ‘y’ in config.php

    $config['protect_javascript'] = "y"; //(which I think is mainly for curly braces)

    EE Version:

    v2.4.0 - Build: date  20120123

    In my template I have this:

    for (var i = 0, j = temp.length; i < j; i++) [removed]('' + temp[i] + ');

    EE is outputting this:

    for (var i = 0, j = temp.length; i < j; i++) [removed]('' + temp<i> + ');

    Note that

    temp[i]
    has changed to
    temp<i>

    This is in a plain textarea custom field.

    Ideas what’s going on?

    Thanks
    John

  • #2 / Apr 23, 2012 1:23pm

    Shane Eckert

    7174 posts

    Hello johnniefp,

    This is being converted to BBcode. = <i>.

    There is no override for this, so the JS will need to go into a template.

    You can also try

    ["i"]

    This will stop the conversion to BBcode, but it’s now you have quote marks around the i.

    Does that make sense?

    Cheers,

  • #3 / Apr 23, 2012 2:00pm

    RevaCo

    240 posts

    Ahhh, That one drove me mad for hours!
    I changed my js count var to a non BBCode clashing [h] alpha character and all is happy in the world.

    Thanks
    John

  • #4 / Apr 24, 2012 3:06pm

    Shane Eckert

    7174 posts

    Hi John,

    😊 Glad that things are good now!

    If you need anything else, please just let us know by opening a new thread.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases