Re: template from var
| From: | Marius Manolea | Date: | Wed, 01 Sep 2004 07:07:28 +0000 |
| Subject: | Re: template from var | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11747@lists.php.net to get a copy of this message | ||
hi,
i wrote this member function ... it works for me
function execTemplate($tpl)
{
$this -> _compile_source('evaluated template', $tpl, $code);
ob_start();
$this -> _eval("?>" . $code);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
it will return the output of the compiled template.
if you want a regullar function:
function execTemplate(&$smarty, $tpl)
{
$smarty -> _compile_source('evaluated template', $tpl, $code);
ob_start();
$smarty -> _eval("?>" . $code);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
regards,
marius
"Paul" <pardel@gmail.com> wrote in message
news:eaefd3b04083002407a957795@mail.gmail.com...
> Hi all,
> Is there any way to use the content of a variable as a template?
> Thank you!
> Paul