JOOMLA TRAINING | JOOMLA COURSES

^ Scroll to Top
joomla

When you need a different condition for your Joomla 1.7 homepage

If you need to place a condition  for youe home page in your joomla 1.7 template - we prefer using this code:

<?php if ($menu->getActive() == $menu->getDefault()) { ?>PUT ACTION HERE <?php } ?>

It doesn't depend on function, but purely works on the fact that if you are on the home page.

When do we use this conditional statement?

We don't use it for module assignment or any of the things you can do in the backend (yoursite.com./administrator).

We like it for adding a class or id to an element unique to the home page.