Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

variable inside config variables
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
sagi
Smarty Regular


Joined: 30 Jul 2003
Posts: 43

PostPosted: Mon Oct 06, 2003 11:39 pm    Post subject: Reply with quote

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 Smile

thanks for all the help guys.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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
Protected by Anti-Spam ACP