[英]Include PHP File in Smarty tpl
我想在 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
使用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 標准和解決方案,您應該使用鈎子和模塊:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.