[英]Smarty 2 in 1 variable
How can i put in variable 'A', variable 'B' 如何输入变量“ A”,变量“ B”
I have two variable {$current_page}
and {$globalContent.INDEX_BTN}
我有两个变量
{$current_page}
和{$globalContent.INDEX_BTN}
How can i make something like that -> {$globalContent.{$current_page}_BTN}
that word INDEX in variable {$globalContent.INDEX_BTN}
will switched to value from variable {$current_page}
我
{$globalContent.{$current_page}_BTN}
类似的事情-> {$globalContent.{$current_page}_BTN}
,变量{$globalContent.INDEX_BTN}
{$globalContent.{$current_page}_BTN}
中的单词INDEX将从变量{$current_page}
转换为值
Edited: I want to do in Smarty, something like this what i can do in PHP 编辑:我想在Smarty中做,就像这样我可以在PHP中做
$lang = array with text
$curr_page = 'ORDER';
echo $lang[$curr_page.'_BTN'];
PS variable $lang
it's array with many indexes which contain text, and two of them INDEX_BTN & ORDER_BTN
, so can i make something like that PHP code in Smarty ? PS变量
$lang
是具有许多包含文本的索引的数组,其中两个索引是INDEX_BTN & ORDER_BTN
,因此我可以在Smarty中制作类似PHP的代码吗? That array lang assigned to Smarty like {$globalContent}
分配给Smarty的数组lang,例如
{$globalContent}
{assign var="page_index" value=join('',array($current_page,'_BTN'))}
{$global_content.$page_index}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.