Php Prestashop 1.5.4使用自定义挂钩创建自定义模块
我尝试了多种方法来创建我自己的模块,其中包含一个必须出现在header.tpl中的列中的钩子。不幸的是,我遵循的教程不起作用。我做错了什么?例如,我的步骤: 步骤1:创建我的模块事件 目录:prestashop\modules\events 文件:logo.gif、logo.png、events.tpl、events.php 在events.php中:Php Prestashop 1.5.4使用自定义挂钩创建自定义模块,php,smarty,hook,prestashop,Php,Smarty,Hook,Prestashop,我尝试了多种方法来创建我自己的模块,其中包含一个必须出现在header.tpl中的列中的钩子。不幸的是,我遵循的教程不起作用。我做错了什么?例如,我的步骤: 步骤1:创建我的模块事件 目录:prestashop\modules\events 文件:logo.gif、logo.png、events.tpl、events.php 在events.php中: <?php if (!defined('_PS_VERSION_')) exit; class Events extends Modul
<?php
if (!defined('_PS_VERSION_'))
exit;
class Events extends Module
{
public function __construct()
{
$this->name = 'events';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'Dinizworld';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('Dinizworld Events');
$this->description = $this->l('Upcoming events.');
$this->confirmUninstall = $this->l('Are you sure you want to delete this module?');
}
public function install()
{
return parent::install() && $this->registerHook('hookEvents');
}
public function hookEvents($params)
{
//return $this->display(__FILE__, 'events.tpl');
return "test message";
}
}
试试看
而不是
$this->registerHook('hookEvents')
编辑
在header.tpl中
{hook h='events'}
{hook h='events'}