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.

More 1.7 woes: PHP in static pages now not working?

December 29, 2010 3:37pm

Subscribe [3]
  • #1 / Dec 29, 2010 3:37pm

    mhulse

    329 posts

    Hi,

    I found another 1.7 issue with some essential plugins…

    I am not asking for plugin support, but just needing some tips on why these plugins broke.

    Static page template snippet:

    ...
    {exp:allow_eecode embed="y"}{static_body}{/exp:allow_eecode}
    ...


    Static page:

    {exp:php}
    echo "hello world!";
    {/exp:php}dddd

    All I get as output is “dddd”.

    What changed in 1.7? The above code was working in 1.6.8. 😊

    Also, I get this error for the first time when visiting the static page:

    Content Encoding Error
    The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
    *  Please contact the website owners to inform them of this problem.

    I am wondering if we fudged-up our upgrade/install when upgrading to 1.7? I really need those two plugins working again. :(

    Any thoughts? Did 1.7 introduce stricter code that makes it so said plugins fail to function?

    Thanks!

    Micky

  • #2 / Dec 29, 2010 3:55pm

    mhulse

    329 posts

    So, it looks like it is the php plugin that is failing… This code works:

    {encode="[email protected]" title="testing"}

    I looks like I still get that content encoding error on the first few loads after updating the static page entry though.

    Now I just need to figure out why the php plugin I am using died. :(

  • #3 / Dec 29, 2010 4:01pm

    Ingmar

    29245 posts

    Unfortunately I am not familiar with that plugin. Is there a reason you’re not using regular PHP code on a PHP-enabled template?

  • #4 / Dec 29, 2010 4:20pm

    mhulse

    329 posts

    Hi Ingmar!

    Unfortunately I am not familiar with that plugin. Is there a reason you’re not using regular PHP code on a PHP-enabled template?

    This is in an entry, and not a template. 😊

    Out of all the other “Allow PHP” plugins (in an entry), I found that this one worked the best.

    The plugin itself is very simple:

    function Php()
        {
            global $TMPL, $FNS;
            return $FNS->evaluate('<?php '.$TMPL->tagdata.' ?>');
        }

    Unfortunately, it looks like the author (expressionengineer.com) has no support, which is cool… I mean, it is not like this plugin is complicated! :D

    I forget the exact reason why I liked this plugin, but I think it had to do with where the PHP code was output on the entry/page when viewed via browser… Some of the other plugins put the PHP at the top of the page regardless of where the PHP was in the flow of the document (or maybe that happened when I used PHP directly?)

    As a quick fix I will try using:

    http://loweblog.com/freelance/article/ee-allow-php-plugin/

    This is looking like a plugin issue now… Sorry to bug ya’ll… I guess I was just suprised to see several of our static pages broken after the upgrade (for example, I used this php plugin to set JS and/or CSS headers for serving either file type; after the upgrade, those pages broke because the php header code was not working due to the PHP plugin breaking.)

    Using that lowe plugin should be the fix.

    Thanks so much for helping out! Hopefully this is that last problem I find with our 1.7 upgrade!

    Man, I have never had this much troubles with an EE upgrade… Normally, things are smooth as butta!

  • #5 / Dec 29, 2010 4:42pm

    mhulse

    329 posts

    Looks like that Lowe one works.

    Unfortunatley, I can’t seem to set the header content type using it though. :(

    {exp:allowphp}header('Content-type: text/javascript');{/exp:allowphp}

    Everything gets served as text/html even though I am using the above to override.

    I tried turning off “Generate HTTP Page Headers?” and “Enable GZIP Output?” (thought maybe the gzip was messing with things too)... No luck.

    Oh well… I need to solve this fast, so I am going to move all my CSS/JS static pages to the server as real js/css files.

    I wonder why this broke in 1.7? (Edit: Maybe it is our servers… The IS dept. has been tweaking things on the server end, so maybe that is the cause of not being able to set Content-Type header and/or that encoding error?)

    Thanks!
    Micky

  • #6 / Dec 29, 2010 10:09pm

    John Henry Donovan

    12339 posts

    Micky,

    I tried turning off “Generate HTTP Page Headers?” and “Enable GZIP Output?” (thought maybe the gzip was messing with things too)... No luck.

    What browser are you using? Safari?

    If you log yourself out as admin do you still see the content encoding error?

  • #7 / Dec 30, 2010 2:38pm

    mhulse

    329 posts

    Hi John! Thanks so much for the reply.

    What browser are you using? Safari? If you log yourself out as admin do you still see the content encoding error?

    I have been using Firefox. I probably should have checked Safari when it comes to those CSS/JS files… IIRC, doesn’t that browser not like Gzip on said files? Maybe it is a good thing that I moved them to the server vs. hosting them in static pages module?

    Update: Ahhhh, it looks like the content encoding error must be the PHP plugin I was using (the non-Lowe one). As soon as I switched back to {exp:php} and updated the entry, that’s when I got the content encoding error.

    I am going to stop using the {exp:php} plugin and go with the Lowe one (if/when I need to use PHP in my entries).

    When it comes to the Content-Type problems, I just moved all of my JS/CSS static page CSS/JS entries to the server and updated the links in the calling files. Problem solved.

    Thanks SOOOOOOO much for all of your help! I hate to admit it, but I get kinda frantic when stuff breaks on my work’s EE installs. :D

    Man, I can’t wait for my work to upgrade to EE2! I love 1.x, but 2.x is definitely a sweet upgrade.

    Anyway, thanks so much! Have an excellent New Year!

    Cheers,
    Micky

  • #8 / Dec 30, 2010 4:32pm

    Ingmar

    29245 posts

    Very glad to see you’re all set. Please post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases