roymilder Posted November 28, 2012 Share Posted November 28, 2012 Hi, Somehow I can't seem to find out how to include my module CSS in my own module. <modulename> = name of the module <modulename>.php contents: public function install() { if (parent::install() == false OR !$this->registerHook('home') OR !$this->registerHook('header')) return false; return true; } public function hookHeader($params) { Tools::addCSS($this->_path.'/css/<modulename>.css'); } This doesn't work. I have tried some other options as well like: public function hookHeader($params) { Tools::addCSS($this->_path.'css/<modulename>.css'); } public function hookHeader($params) { Tools::addCSS($this->_path.'<modulename>/css/<modulename>.css'); } public function hookHeader($params) { Tools::addCSS(_PS_MODULE_DIR_.$this->name.'/css/<modulename>.css'); } etc. I also copied my CSS to /themes/THEMENAME/css/modules/MODULENAME/ but this doesn't seem to work either. My CSS file is (to make sure the path is correct) in: /modules/MODULENAME/ /modules/MODULENAME/css/ /themes/THEMENAME/css/modules/MODULENAME/ but still: it isn't included in my module. What am I doing wrong? Link to comment Share on other sites More sharing options...
Dreamtheme Posted December 1, 2012 Share Posted December 1, 2012 (edited) your CSS should be assigned to your TPL file, not in php one. After that you can put css code in your module name css file or in global.css for example: Mymodule.tpl <- css class defined here for example "<div class="mymodule"></div>" Edited December 1, 2012 by Dreamtheme (see edit history) Link to comment Share on other sites More sharing options...
roymilder Posted December 3, 2012 Author Share Posted December 3, 2012 your CSS should be assigned to your TPL file, not in php one. After that you can put css code in your module name css file or in global.css for example: Mymodule.tpl <- css class defined here for example " " Hi Dreamtheme, First: thanks for your reply. I did include my CSS in my .tpl file: <div id="" class="infinite_scroll_block""></div> I have created a module CSS file: infinitescroll.css which contains: .infinite_scroll_block {} I'm trying to add the CSS file to the header section using: public function hookHeader($params) { Tools::addCSS(_PS_MODULE_DIR_.$this->name.'/css/infinitescroll.css'); } or one of the other options mentioned above. However, this isn't working: I can't use the declared CSS styles in my .tpl file. It looks like I'm trying to include the CSS file using a wrong method. Perhaps you have another suggestion? Thanks in advance! Roy 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