How to use a conditional statement in your Joomla website.

So I ran across a post in the JoomlaShack Customization Forums where a Joomlashack customer wanted to place a pathway on every page except the home page. It makes a lot of sense to me as the person viewing the web page would know where they are, they are at home. :-)

This is easy to do in the administrator with a menu item, module, or component. What about a ‘module position’ or ‘Bread Crumbs/Pathway’? Using the technique at Compass you can hide module positions if they are not being used to create a full with wrapper, or set the size of the modules if you have more then one in a row.

But what about if you wanted to exclude the ‘Bread Crumbs/Pathway’ from the home page? You would add a conditional statement something like the following:

 

<?php if (strtolower($option) != 'com_frontpage') { ?>	<?php mosPathWay(); ?><?php ?>

As you can see it looks for the com_frontpage and uses the ‘!=’ to determine that it should Not display. As you might have guessed the != translates to NotEqual.

Post to Twitter Tweet This Post