Re: [SMARTY] $smarty->display("sting with template content...") ?
| From: | Jerry Verhoef | Date: | Thu, 16 Jan 2003 13:43:46 +0000 |
| Subject: | Re: [SMARTY] $smarty->display("sting with template content...") ? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7224@lists.php.net to get a copy of this message | ||
I don't see any reason why it shouldn't work
Try something like this...
function src_get_template ($tpl_name, &tpl_source, &$smarty_obj)
{
if ($sql->num_rows) {
$tpl_source = $tpl_name
return true;
} else {
return false;
}
}
function src_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
// do database call here to populate $tpl_timestamp.
$tpl_timestamp = time();
return true;
}
function src_get_secure($tpl_name, &$smarty_obj)
{
// assume all templates are secure
return true;
}
function db_get_trusted($tpl_name, &$smarty_obj)
{
// not used for templates
}
// register the resource name "src"
$smarty->register_resource("src", array("src_get_template",
"src_get_timestamp",
"src_get_secure",
"src_get_trusted"));
$smarty->display("src:".$content);
Haven;t tried this code....
On Thu, 16 Jan 2003 14:27:23 +0100, Yar3k wrote:
>Is it possible to display template not from file or db but php
>variable? I would like to use
>
><?php
>...
>$content=<<<CONTENT
>....
>CONTENT;
>$smarty->display($content);
>?>
>
>
>Is it possible?
>
>--
>Yar3k
>
>
>--
>Smarty General Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
http://www.het-y.nl
http://php.start4all.com