Isb Posted May 3, 2013 Share Posted May 3, 2013 Hi guys, I followed step by step this guide about module developing. Hovewer when i try to do addCss ( or JS ) in the hookDisplayHeader, it doesn't show anything in the <head>. <?php if( ! defined( '_PS_VERSION_' ) ) exit; class blockinfo extends Module{ public function __construct(){ $this->name = 'blockinfo'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Ivano Mercuri'; $this->need_instance = 0; $this->ps_versions_compliancy = array( 'min' => '1.5.4.1' , 'max' => '1.6'); parent::__construct(); $this->displayName = $this->l('Informazioni'); $this->description = $this->l('Inserisce le informazioni nell\'header'); $this->confirmUninstall = $this->l('Lo vuoi disinstallare?'); if (!Configuration::get('BLOCKINFO')) $this->warning = $this->l('No name provided'); } public function install(){ if ( Shop::isFeatureActive() ){ Shop::setContext( Shop::CONTEXT_ALL ); } return parent::install() && $this->registerHook( 'leftColumn' ) && $this->registerHook( 'header' ) && Configuration::updateValue( 'BLOCKINFO' , 'my friend' ); } public function uninstall(){ return parent::uninstall() && Configuration::deleteByName( 'BLOCKINFO' ); } public function hookDisplayLeftColumn( $params ){ $this->context->smarty->assign( array( 'blockinfo_name' => Configuration::get( 'BLOCKINFO' ), 'blockinfo_link' => $this->context->link->getModuleLink( 'blockinfo', 'display' ) ) ); return $this->display( __FILE__ , 'blockinfo.tpl'); } public function hookDisplayRightColumn( $params ){ return $this->hookDisplayLeftColumn( $params ); } public function hookDisplayHeader(){ $this->context->controller->addCSS( $this->_path . 'css/blockinfo.css' , 'all' ); } } ?> Of course, in the active theme the {$HOOK_HEADER} esists. What should I do to make that function works? Thank you Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2013 Share Posted May 3, 2013 does the file exist? modules/blockinfo/css//blockinfo.css ? can you also try to use the $params variable public function hookDisplayHeader($params){ instead the: public function hookDisplayHeader(){ another suggestion: public function hookHeader($params) { instead the: public function hookDisplayHeader(){ 1 Link to comment Share on other sites More sharing options...
Isb Posted May 3, 2013 Author Share Posted May 3, 2013 By adding $params, it works. However in that guide this is not explained. it is better to modify the guide in the future Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2013 Share Posted May 3, 2013 thanks for information that it works for you :-) i can go ahead and mark this thread as solved regards Link to comment Share on other sites More sharing options...
jorozco Posted January 7, 2015 Share Posted January 7, 2015 Hi Everybody!I just debug the $params var, and just for documentation purposes: What exactly stores this variable?Thanks in advance! Link to comment Share on other sites More sharing options...
sascom Posted June 16, 2017 Share Posted June 16, 2017 I'd like to precise that if the css file exists but is empty, it is NOT included as well. hope it helps someone 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