[我想在productdetail-full.tpl文件(Smarty / Prestashop 1.6.x)中包括一个输出一些HTML的PHP脚本
我尝试过:
{php}
include('show-stock-pos.php');
{/php}
和
{include_php 'show-stock-pos.php'}
但是它们都已弃用。有什么建议吗?
谢谢!
您应该为此使用SmartyBC - Backwards Compatibility Wrapper
,因为不建议在模板中使用php代码。
而不是:
require_once('path/to/smarty/libs/Smarty.class.php');
$smarty = new Smarty();
用途:
require_once('path/to/smarty/libs/SmartyBC.class.php');
$smarty = new SmartyBC();
而且您将可以在Smarty模板文件中使用PHP。
关于此的更多信息:
Prestashop是使用钩子显示信息的模块化系统。
根据Prestashop标准和解决方案,应使用挂钩和模块: