1
这不显示:中包括一个.tpl不起作用
include {php} echo "hello" {/php}
Smarty.class.php
和smarty_security.php
我有$allow_php_tag = true;
但{php} echo "hello" {/php}
不行。没有显示“你好”在我身边。
为什么不呢?
这不显示:中包括一个.tpl不起作用
include {php} echo "hello" {/php}
Smarty.class.php
和smarty_security.php
我有$allow_php_tag = true;
但{php} echo "hello" {/php}
不行。没有显示“你好”在我身边。
为什么不呢?
在Smarty模板使用PHP不建议在Smarty的3.1 已被弃用,但是如果你真的需要在Smarty的模板中使用PHP,你需要使用SmartyBC
类,而不是Smarty
类。要做到这一点:
转到config/smarty.config.inc.php
变化
require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
到
require_once(_PS_SMARTY_DIR_.'SmartyBC.class.php');
$smarty = new Smarty();
成
$smarty = new SmartyBC();
就是这样。你不需要做更多的事情(在Prestashop 1.6.0.8中测试)