2013-12-20 63 views
0

是否有可能使用while/for循環遍歷配置文件,並獲得鍵/值,當你不知道確切的名稱,但只有該項目以「count」開頭,使用smarty for/while?smarty迭代通過配置文件

例如考慮下面的配置文件的一部分?

countUnitedStates="United States" 
countUruguay="Uruguay" 
countUzbekistan="Uzbekistan" 
countVanuatu="Vanuatu" 
countVaticanCity="Vatican City" 
countVenezuela="Venezuela" 
countVietnam="Vietnam" 
countYemen="Yemen" 
countZambia="Zambia" 
countZimbabwe="Zimbabwe" 

回答

1

所有調入的配置變量是可訪問的低谷

{$smarty.config} 

在模板文件和

$smarty->getConfigVars(); 
在PHP

你可以遍歷這些和搜索字符串你需要在關鍵名稱