Re: Use of PHP-Code in Smarty-Variables
| From: | Justin Patrin | Date: | Sat, 12 Jun 2004 19:02:19 +0000 |
| Subject: | Re: Use of PHP-Code in Smarty-Variables | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11455@lists.php.net to get a copy of this message | ||
Christian Arnold wrote:
Hi, I am transporting my old Homepage to a new one with a Design. Therefore I have to use Templates. So, I have to put into one variable {$text} the old, mostly HTML, Code. I assign it like this:You you want to execute the code of an "old" site and get its output,. you'll need to do some kind of output buffering. ob_start(); include('test.php'); $text = ob_get_contents(); ob_end_clean(); -- paperCrane <Justin Patrin>$smarty->assign('text', implode(file("start.php")));But when I tried to transport my guestbook, or other scripts with PHP inside, into Smarty, nothing happens. Here an example: in the test.php is written:<h1>This is a Test</1>This is a test message<br><?$variable = "<br>php-testmessage";echo $variable;?>End of TestWhen I assign it $smarty->assign('text', implode(file("test.php"))); In the document is only this displayed:This is a TestThis is a test messageEnd of TestBut when I look into the quell code, I can see what I have written. What can I do, to make smarty to execute the PHP-commands? Christian Arnold PS: I am German, so please excuse my English :)