我正在尝试为 Prestashop 制作模块。但是我的 tpl 文件看不到变量。
支付图标.php:
function hookFooter($params){
$group_id="{$base_dir}modules/mymodule/payicon.php";
$smarty = new Smarty;
$smarty->assign('group_id', '$group_id');
return $this->display(__FILE__, 'payicon.tpl');
return false;
}
payicon.tpl:
<div id="payicon_block_footer" class="block">
<h4>Welcome!</h4>
<div class="block_content">
<ul>
<li><a href="{$group_id}" title="Click this link">Click me!</a></li>
</ul>
</div>
</div>
更新:
这是安装:
public function install() {
if (!parent::install() OR !$this->registerHook('Footer'))
return false;
return Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'pay_icon` (
`id_icon` int(10) unsigned NOT NULL,
`icon_status` varchar(255) NOT NULL,
`icon_img` varchar(255) DEFAULT NULL,
`icon_link` varchar(255) NOT NULL,
PRIMARY KEY (`id_icon`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;');
return true;
}