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.

Javascript breaks template - parse error

September 10, 2008 10:17pm

Subscribe [2]
  • #1 / Sep 10, 2008 10:17pm

    oldgoldblack

    113 posts

    Adding a snippet of JavaScript code from an advertiser breaks my templates. Don’t know why. It produces this error:

    Parse error: syntax error, unexpected T_ELSE in /public_html/.../core/core.functions.php(637) : eval()'d code on line 5060

    All my pages have the Google Analytics code, and this has worked without problem. But I am clueless when it comes to js, so I may be missing something obvious. I’ve tried the protect js hidden configuration, set to both yes and no, neither helped.

    Any ideas?

  • #2 / Sep 11, 2008 2:51am

    Ingmar

    29245 posts

    It’s got to do with curly quotes, I should think. Can you show us the code you are trying to add?

  • #3 / Sep 11, 2008 5:33pm

    oldgoldblack

    113 posts

    Sure thing, here’s the include:

    [removed][removed]
    [removed] 
    var boxwidth = 160; 
    displayjobbox(boxwidth); 
    [removed]

    I put the script online here for the time being.

    UPDATE: The advertiser said they have “reviewed the [JavaScript] code ... The issue should now be resolved.” I’m not sure what they may have changed, but I’ve asked and am waiting on a response.

    But now, I get an entirely blank page when trying to load the template. Just nothing there.  😠

  • #4 / Sep 11, 2008 5:44pm

    Ingmar

    29245 posts

    Do you’ve got a link to the site? Also, what version and build are you on? Let us know what you hear back from them, too.

  • #5 / Sep 12, 2008 5:04am

    oldgoldblack

    113 posts

    Well, it’s no longer showing a blank page. Link is here, and the template debugging output is here.

    Running 1.6.2 build 20080129.

  • #6 / Sep 12, 2008 10:45am

    Robin Sowell

    13255 posts

    Hm- I’m still getting a blank page.  And it’s throwing a php error- I can’t spot why the js would cause that.  If you pull out the js, does the page now load?

    And if you put the js on a blank template- does that page error?

    And that’s a fair bit of code- could you put it in an external file and call it via a link?  Would allow caching and declutter a bit.

  • #7 / Sep 12, 2008 4:55pm

    oldgoldblack

    113 posts

    The blank page comes if I embed the js snippet from another template, then I get the blank page. If I leave the code in the original template, then I get the parse error. (I’ve switched it to that now, if you go I think you should see the parse error.

    If I pull out the js, the template (let’s call it phail) works fine. It’s an exact copy of my most common article template, working fine and running live on my right now.

    Just tried the js in a blank template, and it loads fine. Scanning the phail template, it looks like the snippet is not within EE tags.

    Which bit of code do you want me to call via a link? The actual js file the advertising agent wants to remain on their own server, not mine.

  • #8 / Sep 17, 2008 2:14am

    oldgoldblack

    113 posts

    Still haven’t found the problem, but this loops many times in the template debugging:

    (3.065785) Calling Extension Class/Method: Videoplug/renderHTMLCodeWeblog
    (3.069041) Calling Extension Class/Method: Checkbox/modify_template
    (3.069343) Calling Extension Class/Method: Mh_file_ext/modify_template

    I’m not actually using Mark Hout’s file extension any more, so I disabled it. Then I get this:

    (3.326815) Calling Extension Class/Method: Videoplug/renderHTMLCodeWeblog
    (3.329437) Calling Extension Class/Method: Checkbox/modify_template

    Same looping, just sanse Mh_file_ext. Problem is, I need Videoplug and Checkbox. Any ideas? Really banging my head against the desk on this one.

  • #9 / Sep 17, 2008 12:58pm

    Robin Sowell

    13255 posts

    Hm- for a really quick test, can you disable all extensions?  In ‘Admin- Utilities- Extensions’ use the big button top right.  Won’t delete settings but will prevent them being called.  Does it still throw the php error?

  • #10 / Sep 17, 2008 10:24pm

    oldgoldblack

    113 posts

    No, even with all extensions disabled, it still throws PHP error.

    I’ve noticed in the debugging it consistently spends a long time here:

    (2.597548) - End Tag Processing -
    (2.611829) Processing Advanced Conditionals
    (6.487093) - End Template Processing -

    (the post has been updated from earlier version, as I got template debugging back)

  • #11 / Sep 18, 2008 5:51pm

    oldgoldblack

    113 posts

    Any ideas? This is one of the things where the more I look at it, the less it makes sense.

  • #12 / Sep 22, 2008 1:13pm

    Greg Aker

    6022 posts

    Kevin:

    Do you have any custom php in your templates or ExpressionEngine {if} statements in there?  Also, in your embed, do you have the < script type=“text/javascript”> javascript here < /script > tags in there (spaces were put in around the brackets so it comes up in the forum.

    -greg

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

ExpressionEngine News!

#eecms, #events, #releases