Sorin Buturugeanu wrote:

> Hello,
> 
> I am having trouble with a part of my templating script. I'll try to
> explain:
> 
> The template itself is HTML with PHP code inside it, like:
> 
> <div><?=strtoupper($user['name']);?></div>
> 
> And I have the following code as part of the templating engine:
> 
> $template = file_get_contents($file);
> $template = "return <<<TEMPLATE\n".$template."\nTEMPLATE;\n";
> $template = eval($template);
> 
> The problem is that the eval() HEREDOC combination gives the following
> output:
> 
> <?=strtoupper(Array['time']);?>
> 
> If in the HTML file (template) I use
> 
> <div><?=strtoupper({$user['name']});?></div>
> 
> I get  <?=strtoupper(username);?> as an output.
> 
> I have tried closing the php tag like this:
> 
> $template = "return <<<TEMPLATE\n?>".$template."\nTEMPLATE;\n";
> 
> but the extra ?> only gets outputed as HTML.
> 
> This is my first post to this mailing list, so I great you all and thank
> you for any kind of solution to my problem.
> 
> Thank you!

Possibly your php environment has short-tags turned off.


Cheers
-- 
David Robley

To save trouble later, Joe named his cat Roadkill Fred
Today is Boomtime, the 56th day of Confusion in the YOLD 3176. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to