Smarty错误:无法识别标签'功能'

时间:2013-07-09 08:41:37

标签: php smarty

这是我的代码,我想在smarty中定义一个函数。

{function name=menu level=0}
<ul class="level{$level}">
{foreach $data as $entry}
{if is_array($entry)}
<li>{$entry@key}</li>
{menu data=$entry level=$level+1}
{else}
<li>{$entry}</li>
{/if}
{/foreach}
</ul>
{/function}

但这是我得到的错误,有人可以帮忙吗?

Fatal error: Smarty error: [in components/scripts.tpl line 1]:
syntax error: unrecognized tag 'function' (Smarty_Compiler.class.php, line 590)
in D:\xampp\htdocs\local_games\layout\default\php\Smarty\Smarty.class.php on line 1095

1 个答案:

答案 0 :(得分:2)

{function}Smarty3-specific,但您可能正在使用Smarty2

相关问题