Jump to content

Hookheader Not Adding Js Nor Css


Recommended Posts

i'm creating new module,

i've created and registered new hook

everythink works fine, the tpl is printed on the new hook

but i cant find the way to add css or js :(

 

this function is doing nothing :S

 public function hookHeader($params)
    {
        $this->context->controller->addJS($this->_path.'views/js/front.js', 'all');
        $this->context->controller->addCSS($this->_path.'views/css/front.css', 'all');

   }

(files does exists)

 

 

but this one, for backoffice, works fine:
    public function hookBackOfficeHeader()
    {
        $this->context->controller->addJS($this->_path.'views/js/back.js');
        $this->context->controller->addCSS($this->_path.'views/css/back.css');
    }

 

i have followed all answers in forum but nothing works for me :(

 

any help please?? :):):)

 

direccionespredefinidas.php

 

Link to comment
Share on other sites

    /**
     * Add the CSS & JavaScript files you want to be added on the FO.
     */
    public function hookHeader($params)
    {
        $this->context->controller->addJS($this->_path.'views/js/front.js', 'all');
        $this->context->controller->addCSS($this->_path.'views/css/front.css', 'all');
     /*   $this->context->controller->addJS(__FILE__.'/views/js/front.js', 'all');
        $this->context->controller->addCSS(__FILE__.'/views/css/front.css', 'all');*/
      /*  $allowed_controllers = array('address', 'addresses');
        $_controller = $this->context->controller;
        if (isset($_controller->php_self) && in_array($_controller->php_self, $allowed_controllers)) {
            $this->context->controller->addCSS($this->_path . 'views/css/front.css', 'all');
            $this->context->controller->addJS($this->_path . 'views/js/front.js');
        }*/

    }

    public function hookDisplayHeader()
    {
        /* Place your code here. */
    }

it's calling hookDisplayHeader which does nothing.

 

Change public function hookDisplayHeader() to public function hookDisplayHeader($params)

And add this to the method body:  return $this->hookHeader($params)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...