|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sagi Smarty Regular
Joined: 30 Jul 2003 Posts: 43
|
Posted: Mon Oct 06, 2003 11:39 pm Post subject: |
|
|
okay.. so i ended up writing a simple output plugin, here it is:
i'm using it in my prepend file (that is setting all the global variables and the smarty object(.
Code: |
// from->to pairs to replace in the output filter after the page is generated
$output_replace = array();
|
then, i'm putting the pairs that i want to support in the config files, like:
Code: |
$output_replace['{$mediaurl}'] =& $mediaurl;
$output_replace['{$mmediaurl}'] = MEDIA_URL;
|
and so on.
the output filter:
Code: |
// -- OUTPUT FILTER --
// we use this output filter to replace smarty-like vars, like {$mediaurl} in the config files after the page is generated.
function output_replacevar($output, &$smarty)
{
return strtr($output, $GLOBALS['output_replace']);
}
$smarty->register_outputfilter('output_replacevar');
// -- END OF OUTPUT FILTER --
|
I know it is a bit ugly, but it's the best solution I could think of. I really hope I can get rid of it one day when smarty supports it it
thanks for all the help guys. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|