如何使用smarty模板获取数组的特定索引


how to get a particular index of array using smarty templates

hi我正在开发一个氧化环境中的模块。它使用巧妙的模板。现在我想要得到一个特定的数组索引。我的代码看起来像

[{foreach from=$language item=lang}]
  <div id="stores">
   [{if !array_key_exists($lang->id,$language_array)}]
     <img src="[{$join_image}]" /> <input type="radio" name="sys_lang" id="sys_lang" />[{$lang->name}]
   [{else}]
    <img src="[{$join_image}]" /> [{$lang->name}] [{$language_array[$lang->id]}]
[{/if}]
 </div>
[{/foreach}]

但它正在制造的致命错误

Fatal error: Smarty error: [in froomerce_fconnect.tpl line 74]: syntax error: unrecognized tag: $language_array[$lang->id] (Smarty_Compiler.class.php, line 446) in D:'wamp'www'oxid_froomerce'core'smarty'Smarty.class.php on line 1093

我已经搜索了所有在smary中获取变量的正确语法只放{}括号的地方。但是CMS oxid强制我对变量使用[{}]。有人问我怎么能得到像这个这样的数组的特定索引的值吗

[{$language_array[$lang->id]}]

谨致问候,Awais Qarni

尝试更改默认的智能分隔符。例如:

$smarty->left_delimiter = '[{';
$smarty->right_delimiter = '}]';

请参阅http://www.smarty.net/docsv2/en/language.escaping.tpl