Jump to content

Load CSS last


Recommended Posts

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(){
  ), 'all');


It works fine, but it's loaded before all the modules' CSS.


Where can I include this CSS so it's loaded last?




Link to comment
Share on other sites

Thanks for your reply math_php.



=> 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

  • 2 weeks later...

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




public function initContent()








class FrontController extends FrontControllerCore




And place your stylesheet in:



Thanks doobdargent!

  • Like 2
Link to comment
Share on other sites

  • 5 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...