2014-09-22 76 views
1

这不显示:中包括一个.tpl不起作用

include {php} echo "hello" {/php} 

Smarty.class.phpsmarty_security.php我有$allow_php_tag = true;{php} echo "hello" {/php}不行。没有显示“你好”在我身边。

为什么不呢?

回答

2

在Smarty模板使用PHP不建议在Smarty的3.1 已被弃用,但是如果你真的需要在Smarty的模板中使用PHP,你需要使用SmartyBC类,而不是Smarty类。要做到这一点:

  1. 转到config/smarty.config.inc.php

  2. 变化

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中测试)