Home Articles Template Tips

Conditional module display

   
May 12, 2009 by Victor    

If you‘ve been playing with Joomla templates, either trying to build your own or customize an existing one, you’ve most likely come across the following issue: You need to conditionally load stuff on your webpage. A few examples follow to give you the basic idea:

  • You may fancy loading various style sheets conditionally throughout your entire website. This is either for spicing it up or for maintaining multiple layouts. For example, you could use a different style sheet to eliminate a side column or to change the background.
  • You may need to change on the fly the position of a module. A good candidate for this is the login module which does not need to occupy much space for logged in users.
  • Also, think about these hefty mootools files (or any other Javascript framework), do you need them to be loaded on the front page or is it better to load them later on, where most layout components are already cached in the browser?