Re: Set config file from php?
| From: | Norbert Röcher | Date: | Fri, 17 May 2002 00:00:15 +0000 |
| Subject: | Re: Set config file from php? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4258@lists.php.net to get a copy of this message | ||
"Ivan Voras" <ivoras@fer.hr> schrieb im Newsbeitrag
news:20020509124958.51333.qmail@pb1.pair.com...
> I am looking for a nice way to specify config file for Smarty
templates from
> PHP.
>
> I use config files for color themes and I would like to be able to
just
> specify a different config file when the user changes the theme
WITHOUT
> having to insert the required smarty command in each and every
template.
>
> I expect something like:
>
> $smarty = new Smarty();
> $smarty->loadConfig ($currentconfig)
>
> I did a workaround, involving modifying Smarty_compiler to insert
the
> hard-coded required output, but it is very messy and I need to
update it
> when new versions of Smarty come out.
How about a simple topmost template, including your "real" templates?
Something like:
topmost template:
{config_load file="config.conf"}
{include file="$yourTemplate.tpl"}
That_'s all. So this wouldn't affect your application itself too hard.
;-)
Regards,
Norbert