my smarty got unknown tag , but it is a legal tag

2019-09-06 11:29发布

currently i change smarty 2 -> version 3

but after i change got problem as below.

SmartyCompilerException: Syntax Error in template 
"/home/test/engine/mobile9/template/t_footer.tpl" on line 28 
"{php}" unknown tag "php" in /home/test/engine/modules/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 617

after that i check smarty 3 documentations. it shown {php} is valid operator.

1条回答
啃猪蹄的小仙女
2楼-- · 2019-09-06 12:02

Check the documentation here:

IMPORTANT NOTICE

{php} tags are deprecated from Smarty, and should not be used. Put your PHP logic in PHP scripts or plugin functions instead. Note

As of Smarty 3.1 the {php} tags are only available from SmartyBC.

If you're using Smarty 3.0x, it should work. If you're using Smarty 3.1, you have to install the SmartyBC class (Backwards Compatibility Wrapper) for the use of the {php}-Tag.

But where possible try to follow Smartys advice: Put PHP logic in PHP scripts, and not into the Smarty templates.

查看更多
登录 后发表回答