[英]Smarty 2 in 1 variable
如何輸入變量“ A”,變量“ B”
我有兩個變量{$current_page}
和{$globalContent.INDEX_BTN}
我{$globalContent.{$current_page}_BTN}
類似的事情-> {$globalContent.{$current_page}_BTN}
,變量{$globalContent.INDEX_BTN}
{$globalContent.{$current_page}_BTN}
中的單詞INDEX將從變量{$current_page}
轉換為值
編輯:我想在Smarty中做,就像這樣我可以在PHP中做
$lang = array with text
$curr_page = 'ORDER';
echo $lang[$curr_page.'_BTN'];
PS變量$lang
是具有許多包含文本的索引的數組,其中兩個索引是INDEX_BTN & ORDER_BTN
,因此我可以在Smarty中制作類似PHP的代碼嗎? 分配給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.