doobdargent Posted November 30, 2012 Share Posted November 30, 2012 Hello, I've overriden the FrontController::setMedia() method to add another CSS file (so it will be linked for every themes) right after the global CSS. public function setMedia(){ ... $this->addCSS(array( _THEME_CSS_DIR_.'global.css', _PS_CUSTOMER_URI_.'css/style.css' ), 'all'); ... } It works fine, but it's loaded before all the modules' CSS. Where can I include this CSS so it's loaded last? Regards, Bastien. Link to comment Share on other sites More sharing options...
math_php Posted November 30, 2012 Share Posted November 30, 2012 (edited) Hi Bastien, Perhaps by putting first parent::setMedia(); or adding your css in displayHeader() or in preProcess() ? Regards Edited November 30, 2012 by math_php (see edit history) Link to comment Share on other sites More sharing options...
doobdargent Posted November 30, 2012 Author Share Posted November 30, 2012 Thanks for your reply math_php. parent::setMedia(); $this->addCSS(...); => still called before modules displayHeader() is not called. Looks like it's deprecated now. In postProcess(), $this->css_files is an array containing css, but not the modules ones, if I add the one, it will still appear before the modules' CSS. I'll continue to dig in ! Link to comment Share on other sites More sharing options...
math_php Posted November 30, 2012 Share Posted November 30, 2012 Then you are working with 1.5, I will also continue to dig in. Regards Link to comment Share on other sites More sharing options...
doobdargent Posted November 30, 2012 Author Share Posted November 30, 2012 (edited) With some debug_print_backtrace() magic, I found that the modules are called in the FrontController::initContent() method, so when I overwrite it and add the css at the end, it appears after the modules' CSS! Edited November 30, 2012 by doobdargent (see edit history) 1 Link to comment Share on other sites More sharing options...
roymilder Posted December 11, 2012 Share Posted December 11, 2012 With some debug_print_backtrace() magic, I found that the modules are called in the FrontController::initContent() method, so when I overwrite it and add the css at the end, it appears after the modules' CSS! Thank you! This worked great. For others reading this: Change ps_root/override/classes/controller/FrontController.php Add: public function initContent() { parent::initContent(); $this->addCSS(_THEME_CSS_DIR_.'YOUR_STYLESHEET.css'); } Between: class FrontController extends FrontControllerCore { } And place your stylesheet in: ps_root/themes/theme_name/css/ Thanks doobdargent! 2 Link to comment Share on other sites More sharing options...
c.harrison1988 Posted May 21, 2013 Share Posted May 21, 2013 This is how it should be by default. Of course the global stylesheet should override the modules CSS. It's very developer-unfriendly to have to hack and override the CONTROLLERS for this. 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