Re: [SMARTY] How to use a template in a PHP variable instead saved in a file?
| From: | Monte Ohrt | Date: | Sun, 08 Dec 2002 21:17:28 +0000 |
| Subject: | Re: [SMARTY] How to use a template in a PHP variable instead saved in a file? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6698@lists.php.net to get a copy of this message | ||
You want to evaluate a variable as a template, you can with eval.
{eval var=$mytemplatesource}
http://smarty.php.net/manual/en/language.function.eval.html
DeBo wrote:
Hi Scott, hi Rasmus, you wroteIn PHP: $smarty->assign('file_name', $php_var); In the template: {include file=$file_name}Yes, it's right that I can use assign and a $variable instead of the filename. But I would'nt like to use a variable instead of the filename, I would like to use a variable instead of the file itself. Means, that I would like to have the full template (my HTML code with smarty macros in a $variable instead in a file. I.e. in smarty you can write an include statement like this; { include file="mytemplatefile.tpl" var1=value1 var2=value2 } And I need something like this: { include variable=$mytemplatesource var1=value1 var2=value2 } Is this possible to use a variable with the template source instead of a file with the emplate source? Debo