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.

Packed Javascript in Templates

August 15, 2008 4:58pm

Subscribe [2]
  • #1 / Aug 15, 2008 4:58pm

    Jacob Fentress

    37 posts

    A quick note before I go into the problem:

    At work, we are running 1.5.1. I don’t have permissions to upgrade or edit system files, and I am waiting on IT to upgrade to the latest version.


    With that out of the way, here is the problem I’m seeing:

    I have to load javascript files as templates on this site (I keep them as normal files on my other sites that run EE). This works fine on the site - most of the time. The javascript file doesn’t seem to work at all if it is packed or minimized before I copy it into the template.

    Does anyone else have this problem? I just want to shave some filesize off of these files.

    Thanks in advance for the help.

  • #2 / Aug 15, 2008 5:15pm

    Ingmar

    29245 posts

    What filetype are you using for your script? That said, does it work if you use external files? There is no real need to keep them in a template, is there?

  • #3 / Aug 15, 2008 5:23pm

    Jacob Fentress

    37 posts

    I’ve set the template type to “Javascript”.

    I would prefer to use an external file, but since on this site I have to go through the IT barrier, I do not have permissions to upload javascript files to the site. It is a pain, and I’ve waited a long time in coming to the forums for advice because I know the situation is far from ideal.

    I can load external (off domain) packed javascript files on this site just fine, but that isn’t a solution I can use longterm.

    Thanks for the help, Ingmar.

  • #4 / Aug 15, 2008 5:28pm

    Lisa Wess

    20502 posts

    You say that the javascript doesn’t work at all if it’s compressed - if you visit it directly, are you getting any errors?  What about it doesn’t work?

  • #5 / Aug 15, 2008 5:32pm

    Ingmar

    29245 posts

    I see. I can only speculate without seeint the actual code, but I suspect that there might be conflicts between Javascript and EE code. I’ve seen it before.

  • #6 / Aug 15, 2008 5:33pm

    Jacob Fentress

    37 posts

    I get a blank page if it is packed and I visit it directly.

    For javascript that is not packed, I can visit directly and it shows up in the browser like a normal javascript file.

    If it is packed, none of the function will run at all. No errors, no nothing.

  • #7 / Aug 17, 2008 11:22am

    Robin Sowell

    13255 posts

    I’d seriously push them to let you upload it as an external file so it’s cached.  It’s not in a template.  Also- push them to upgrade.  1.5 is getting really far back there.

    That said- if you can’t, you can’t.  Have you tried it in a template set to ‘static’?  That might do it.

  • #8 / Aug 17, 2008 2:28pm

    Lisa Wess

    20502 posts

    Also try out protect_javascript.

    If you’re still getting a blank page, then we should proceed with checking out what the error is.  Can you open up Admin -> Utilities -> PHP Info and check for display_errors and tell us the value?

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

    Jacob Fentress

    37 posts

    I finally was able to convince my company to upgrade to EE 1.6.4 (we also changed servers at the same time).

    This message is just to report that everything works as expected now. Thanks for the help - I was stuck and didn’t know where else to turn.

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

    Robin Sowell

    13255 posts

    Whew!  Glad that did the trick and all is squared away.  1.5 was getting pretty far behind- can make it difficult to troubleshoot 😉.

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

ExpressionEngine News!

#eecms, #events, #releases