Show a Module on all Menu Items except selected ones

From Joomla! Documentation

Revision as of 06:56, 3 July 2012 by Greblys (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


One frequently requested feature (which will be added in version 1.6!) is the ability to show a Module on all Menu Items except for a selected list. That way, for example, if you want to show a Module on every page except your home page, you don't have to remember to assign it to each new Menu Item you create.


1) For this example, we are going to assign a Module to every Menu Item except for our home page. We'll use the Joomla! Sample website and the rhuk_milkyway template. Here are the steps: Create a new template position. We'll call it "x-left". We could use an existing template position, but in some cases it might be better to create a new one.

2) Edit the file templates/rhuk_milkyway/templateDetails.xml and add this line after the "breadcrumb" position on line 63:


. This adds the new position to the template.

    • Edit the file templates/rhuk_milkyway/index.php and change these lines 88-92:
<div id="leftcolumn">
<?php if($this->countModules('left')) : ?>
<jdoc:include type="modules" name="left" style="rounded" />
<?php endif; ?>


<div id="leftcolumn">
<?php if($this->countModules('left') && !$this->countModules('x-left')) : ?>
<jdoc:include type="modules" name="left" style="rounded" />
<?php endif; ?>

This code does two things. First, it adds the new position to the template. However, this module position will not be visible on the template and is only used to disable the left column when a module is published to the "x-left" position for a specific page

3)In order to disable the left column, simply create a custom html module and assign it to position "x-left". You may title it whatever you like and enter any content you like for the content...this text will not show on the website. It is recommended to provide a title like "TURN OFF LEFT COLUMN" to properly notify any others who may be working on the website of the module's function. Then simply assign the module to the pages you do not want to see the left column.

Additional positions[edit]

You may want to create corresponding disabled positions for each of the module positions you have. This will allow you to individually turn off any module position on any page of the website.