yeyeyey Posted February 26, 2016 Share Posted February 26, 2016 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 More sharing options...
roja45 Posted February 26, 2016 Share Posted February 26, 2016 /** * 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 More sharing options...
roja45 Posted February 26, 2016 Share Posted February 26, 2016 (edited) Not sure what will happen doing this, you've registered the old and new hook, I would delete the first one. if (!$this->registerHook('header')) return false;if (!$this->registerHook('displayHeader')) return false; Edited February 26, 2016 by roja45 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now