jl_monteagudo Posted July 30, 2010 Share Posted July 30, 2010 Hello all,I'm developing a module but I'm stuck with a problem that don't let me continue. I would be grateful if somebody could help me.I want that the module insert a javascript file and an CSS file in the HEADER section of the resultant HTML. So I have defined in the module the following function: function hookHeader($params) { return $this->display(__FILE__, 'contentslider-header.tpl'); } function hookHome($params) { return $this->display(__FILE__, 'contentslider.tpl'); } The content of the file contentslider.tpl is inserted inside the BODY section, but the content of the file contentslider-header.tpl is not inserted. It seems that the function hookHeader is never called!!! I have been studying other modules to see if I'm doing something wrong, but I think that the module is OK.I've attached the module, so you can see the problem.Than you very much in advance,Jose Luis Monteagudo contentslider.zip 1 Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2010 Share Posted July 31, 2010 You forgot to add the header hook to the install function. You should change line 22 from: if (!parent::install() OR !$this->registerHook('home')) to: if (!parent::install() OR !$this->registerHook('home') OR !$this->registerHook('header')) then when the module is installed, it will be added to both the home and header hooks. 1 Link to comment Share on other sites More sharing options...
jl_monteagudo Posted July 31, 2010 Author Share Posted July 31, 2010 Rocky, thank you very much for your help!!This was my first module, so I didn't know that. I'm not a PHP developer (I'm a Java guy) but I'm quite impressed with the modularity of Prestashop.Best regards,Jose Luis Monteagudo Link to comment Share on other sites More sharing options...
Recommended Posts