I came accross an issue the other day. My client needed a module that displayed some content specific to certain menu items. Since we create a custom joomla component for them, there was not always a menu assigned to the page we are viewing. This left an empty space in the template.

What we did then, was to check in the template if a module was assigned to that module position by using:

1
2
3
4
5
<?php if ($this->countModules( 'user1' )){ ?>
<jdoc:include type="modules" name="user1" style="rounded" />
<?php }else{; ?>
<jdoc:include type="modules" name="user9" style="rounded" />
<?php }; ?>

 

In the user9 module we then assign a default module, to cover the gap left in pages where no module was assigned to.