[SMARTY] resource - variable
"michal.720" <[email protected]>
| Newsgroups | gmane.comp.php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have page content (string) in a variable {$page_content}. I can simply
"echo" this content by smarty like this
My content: {$page_content}
I need to process smarty tags in this string. The content (string) can
be saved into a file or database and then called by {include} plugin
like this
{include file="my-page-content.tpl"} and it will work.
But I need something like resource-from-variable. I created the most
simpliest piece of code which works.
Important code parts:
// resource
function var_get_template($tpl_name, &$tpl_source, &$smarty_obj)
{
$tpl_source = $tpl_name;
return TRUE;
}
...
...
$smarty->register_resource('var',
array(
$page,
'var_get_template',
'var_get_timestamp',
'var_get_secure',
'var_get_trusted'
)
);
And template
{include file="var:`$page_content`"}
Does anybody have any hints about this?
Thanks,
Michal
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php