Some templates have loads of module positions for displaying different modules on different pages. Often, this is unnecessary and a smaller, cleaner template file can be achieved by creative use of module positioning.
If you want to display a module on the frontpage but do not want this to display anywhere else on your site, you can do this by using:
<?php if ($option == "com_frontpage") { ?>
content such as divs etc
} ?>
Example:
<?php if ($option == "com_frontpage") {
mosLoadModules('frontpage_position');
} ?>
(where frontpage position is the module position you want to show only on the front page)
You can even reuse the same module position by specifying a module to load on the frontpage and a different module to load into the same space for your other pages.
Example:
<?php if ($option == "com_frontpage") {
mosLoadModules('frontpage_position');
}
else {
mosLoadModules('other_position');
} ?>
If you enjoyed this post, make sure you subscribe to my RSS feed!













