Module 如何将内容添加到prestashop的head部分,使其显示在hookHeader所在的位置?
我是Prestashop和编程新手,我正在尝试向Prestashop 1.4.5添加一些内容 我制作了一个新的简单模块,它钩住了钩子头。我让它工作了,它在商店的顶部显示了Hello World。但是当我打开站点并打开源代码时,我看到它被添加到doctype之前: 你好,世界 我的php模块如下所示-我没有使用模板: 如果(!defined('\u CAN\u LOAD\u FILES')) 退出 类primanetskintop扩展模块{Module 如何将内容添加到prestashop的head部分,使其显示在hookHeader所在的位置?,module,header,prestashop,Module,Header,Prestashop,我是Prestashop和编程新手,我正在尝试向Prestashop 1.4.5添加一些内容 我制作了一个新的简单模块,它钩住了钩子头。我让它工作了,它在商店的顶部显示了Hello World。但是当我打开站点并打开源代码时,我看到它被添加到doctype之前: 你好,世界 我的php模块如下所示-我没有使用模板: 如果(!defined('\u CAN\u LOAD\u FILES')) 退出 类primanetskintop扩展模块{ function __construct() {
function __construct()
{
$this->name = "skintop";
$this->tab = 'front_office_features';
$this->version = '0.1.0';
parent::__construct();
$this->displayName = $this->l('Insert skin top');
$this->description = $this->l('Skin - ikke slettes');
}
function install()
{
if (!parent::install() OR !$this->registerHook('header'))
return false;
return true;
}
function uninstal()
{
if (!parent::uninstall())
return false;
return true;
}
public function hookHeader($params)
{
echo "Hello World!";
}
为什么hello world没有显示钩子头的位置?我做错了什么
谢谢:D这是因为您无法使用echo向标题添加内容。请尝试:
public function hookHeader($params)
{
return "Hello World!";
}
您可能需要从classes目录分析FrontControler.php,以了解其工作原理