Robnola Posted May 27, 2014 Share Posted May 27, 2014 (edited) I simply wanted to display the mymodule tutorial in my nav bar in the default theme. It displays there, but the CSS is not applied. <?php if (!defined('_PS_VERSION_')) exit; class MyModule extends Module { public function __construct() { $this->name = 'mymodule'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Firstname Lastname'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => '1.6'); $this->dependencies = array('blockcart'); parent::__construct(); $this->displayName = $this->l('My module'); $this->description = $this->l('Description of my module.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); return (parent::install() && $this->registerHook('displayTop') && $this->registerHook('displayNav') && $this->registerHook('displayHeader')); } public function uninstall() { if (!parent::uninstall() || !Configuration::deleteByName('MYMODULE_NAME')) return false; return true; } public function hookDisplayTop($params) { if (!$this->active) return; $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('mymodule', 'display') ) ); return $this->display(__FILE__, 'mymodule.tpl'); } public function hookDisplayHeader($params) { $this->context->controller->addCSS($this->_path.'css/mymodule.css', 'all'); } public function hookDisplayNav($params) { return $this->display(__FILE__, 'mymodule.tpl'); } } ?> TPL file <!-- Block mymodule --> <div id="mymodule_block_left" class="block"> <div class="block_content"> <p>Hello, {if isset($my_module_name) && $my_module_name} {$my_module_name} {else} World {/if} ! </p> <ul> <li><a href="{$my_module_link}" title="Click this link">Click me!</a></li> </ul> </div> </div> <!-- /Block mymodule --> css: div#mymodule_block_left p { font-size: 150%; font-style:italic; color: Red; } any ideas why the css is not displaying? thank you for your help. Edited May 27, 2014 by Robnola (see edit history) Link to comment Share on other sites More sharing options...
dioniz Posted May 28, 2014 Share Posted May 28, 2014 Do you have css file in mymodule/css/mymodule.css? Do you see it in html source? Link to comment Share on other sites More sharing options...
vekia Posted May 28, 2014 Share Posted May 28, 2014 perhaps you run store with activated option: CCC for CSS ? you can check it under adv. parameters > performance tab make sure that this option is disabled (only when you dealing with shop theme, modules etc.) it's necessary to recompile files Link to comment Share on other sites More sharing options...
Robnola Posted May 29, 2014 Author Share Posted May 29, 2014 Do you have css file in mymodule/css/mymodule.css? Do you see it in html source? silly me, yes that was it. Thank you so much Link to comment Share on other sites More sharing options...
BurakD Posted February 11, 2015 Share Posted February 11, 2015 Hi, I have the same problem. I have the css file in modules/mymodule/css/mymodule.css but still not working. I can't see it in html source inspector neither... Where can be the problem? 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