我想要巧妙地显示html变量内容,就像它是html文件的一部分一样,所以我使用“unescape”修饰符就像显示here:
<div id="add">{if $add}{$add|unescape:"html"}{/if}</div>
但我明白了:
Fatal error: Smarty error: [in xxx.html line 20]: [plugin] modifier 'unescape' is not implemented (core.load_plugins.php, line 118) in
XXX/inc/lib/Smarty/Smarty.class.php on line 1095
我的插件目录位于正确的位置:
Smarty$ ls
Config_File.class.php Smarty.class.php Smarty_Compiler.class.php debug.tpl error_log internals plugins
什么可能是错的,我怎么能做我想做的事?
答案 0 :(得分:3)
尝试通过php处理它:
In [238]: a = [1, 2, 3]
In [239]: b = a + [4]
In [240]: b
Out[240]: [1, 2, 3, 4]
您可以使用html_entity_decode功能播放arround以满足您的需求,也可以使用<div id="add">
{if $add}
{php}
echo html_entity_decode($add);
{/php}
{/if}
</div>
或htmlspecialchars_decode()
作为Smarty unascape函数建议。