Jump to content

[SOLVED] Module problem with hookHeader


Recommended Posts

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

  • Like 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...