Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Prestashop 1.5.4使用自定义挂钩创建自定义模块_Php_Smarty_Hook_Prestashop - Fatal编程技术网

Php Prestashop 1.5.4使用自定义挂钩创建自定义模块

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

我尝试了多种方法来创建我自己的模块,其中包含一个必须出现在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 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'}