You are here: resource - variable « Smarty Templates Posts « IT news, forums, messages
resource - variable

Posted by "michal.720" on 08/15/05 17:15

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация