Page 1 of 1

[Solved] custom PHP code in template will not parse

Posted: Fri Oct 26, 2007 6:10 pm
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.

Re: PHP code doesn't work for transparent PNGs

Posted: Fri Oct 26, 2007 8:08 pm
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

Re: PHP code doesn't work for transparent PNGs

Posted: Sat Oct 27, 2007 3:40 am
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.

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

Posted: Sat Oct 27, 2007 4:46 am
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...

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

Posted: Sat Oct 27, 2007 4:51 am
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.