[Solved] custom PHP code in template will not parse

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
casidougal
Forum Members
Forum Members
Posts: 98
Joined: Tue Jun 06, 2006 10:08 pm

[Solved] custom PHP code in template will not parse

Post by casidougal »

I've got an issue that I'm pulling my hair out over that someone out there probably has an easy solution for.

Briefly, I'm trying to implement a great PHP solution for rendering PNG 24 alpha transparency in IE 6.0 and earlier from here http://koivi.com/ie-png-transparency/

I insert this code at the beginning of the file:

Code: Select all

<?php ob_start(); ?>
And this at the end:

Code: Select all

<?php
    include_once 'replacePngTags.php';
    echo replacePngTags(ob_get_clean());
?>

It works great when I create a static PHP page and upload it, However, when I serve this up as a CMSMS template the PHP graphic function doesn't work.

What's even stranger to me, is that when I view the page source then cut and paste the code and upload it as a static page it works.

Has anyone run into this before or do you have any ideas on why this is happening? Might is have something to do with my mod rewrite? 

Out of desperation I tried wrapping the PHP code in {literal}{/literal} tags but it made no difference.

Thanks in advance.
Last edited by casidougal on Sat Oct 27, 2007 3:47 am, edited 1 time in total.
User avatar
Nullig
Power Poster
Power Poster
Posts: 2380
Joined: Fri Feb 02, 2007 4:31 pm

Re: PHP code doesn't work for transparent PNGs

Post by Nullig »

Is this code in your template or page?

Have you tried putting it into 2 UDTs, one at the start and one at the end?

Do you have php tags enabled in your config.php like this:

    $config['use_smarty_php_tags'] = true;

Nullig
casidougal
Forum Members
Forum Members
Posts: 98
Joined: Tue Jun 06, 2006 10:08 pm

Re: PHP code doesn't work for transparent PNGs

Post by casidougal »

Thanks a million . . . I knew it was something easy. The code in UDT's and the switch in config.php did the trick.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: [Solved] custom PHP code in template will not parse

Post by Dr.CSS »

I've always heard if you put php in a UDT you don't need and you don't need to enable php in config if you have it in a UDT this way...
casidougal
Forum Members
Forum Members
Posts: 98
Joined: Tue Jun 06, 2006 10:08 pm

Re: [Solved] custom PHP code in template will not parse

Post by casidougal »

That's what I found . . . actually when I left the in the User Defined Tag I got an error. I did modified config.php at the same time so I don't know if it would work without that step.
Post Reply

Return to “CMSMS Core”