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 error - moved system folder

May 10, 2011 11:56am

Subscribe [2]
  • #1 / May 10, 2011 11:56am

    LMO

    203 posts

    I have recently moved the system folder out the webroot on my server and set all paths to the new locations. The site seems to be working fine, all except the javascript. No files have change its just now throwing a syntax error. Moving the js file from the template folder and relinking it will fix the problem but it will not work from inside the template folder/database.


    here is the link to the site:
      http://64.207.153.199/

    here are both links to the file (loaded down in the footer)
      http://64.207.153.199/index.php/js/script
      http://64.207.153.199/script.js

    Thanks in advanced and any info would be greatly appreciated.

  • #2 / May 11, 2011 4:54am

    John Henry Donovan

    12339 posts

    VIM Interactive,

    To use the JS in your template you will need to make a few edits to it. Make sure there is a line break after every opening curly bracket and before every closing one.

    Like here for example

    $(this).delay(fadeSpeed, function(){$(this).removeClass("top")});

    Change that to

    $(this).delay(fadeSpeed, function(){
    $(this).removeClass("top")
    });
  • #3 / May 11, 2011 11:40am

    LMO

    203 posts

    Thanks for the reply John, I have tried fixing that line but I now see the issue of the problem.

    For some reason the database call to the file is truncating some line breaks and even code. If you look at the two links provided the last line should end on 151. The database call ends on 131 removing some data. I checked the data in the database using phpMyAdmin and it shows all 151 lines.

    Any ideas? Thanks again.

  • #4 / May 11, 2011 11:43am

    John Henry Donovan

    12339 posts

    VIM Interactive,

    It’s not just that line. that was an example. There are more to fix in there. If you do the rest of them I’m pretty sure it will work then

  • #5 / May 11, 2011 12:43pm

    LMO

    203 posts

    The original file and the database record has that. Line breaks before closing brackets “}” and after opening brackets “{”. Its only when its called from the database in EE that it breaks.

  • #6 / May 11, 2011 1:24pm

    LMO

    203 posts

    I have narrowed it down to this code truncating my js file;

    // Remove whitespace from variables.
    // This helps prevent errors, particularly if PHP is used in a template
    $this->template = preg_replace("/".LD."\s*(\S+)\s*".RD."/U", LD."\\1".RD, $this->template);
  • #7 / May 12, 2011 6:07pm

    Lisa Wess

    20502 posts

    Hi, VIM Interactive -

    In Admin > System Preferences > Output and Debugging, what do you have PHP Errors set to?  If you set it to 1, does that help?

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases