|
Posted by Monte Ohrt on 08/15/05 17:25
http://smarty.php.net/manual/en/language.function.eval.php
michal.720 wrote:
>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
>
>
>
Navigation:
[Reply to this message]
|