Using PHP variables in smarty control structures

From: Date: Wed, 02 Oct 2002 02:41:46 +0000
Subject: Using PHP variables in smarty control structures
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6063@lists.php.net to get a copy of this message
Hi, I'm trying to use a PHP variable to control the section for the include_config directive within the template file. I have tried the following methods so far... {* (1) language dependent config file *} <?php if ( $lang == "en" ) print '{config_load file="index.cfg" section="en"}'; if ( $lang == "ja" ) print '{config_load file="index.cfg" section="ja"}'; ?> {* (2) language dependent config file *} {if $lang eq "en"} {config_load file="index.cfg" section="en"} {elseif $lang eq "ja"} {config_load file="index.cfg" section="ja"} {else} {config_load file="index.cfg" section="en"} {/if} {* (3) language dependent config file *} {config_load file="index.cfg" section="$lang"} {* (4) language dependent config file *} {config_load file="index.cfg" section="{$lang}"} But none of these ways have worked. Can anyone help me with this? It seems like it should be simple - have a variable determine which section is loaded from the config file.... Brodie.

« previous php.smarty.general (#6063) next »