Skip to main content

Joomla 3 tutorials

How to control module assignment in more extended way in Joomla?

Sometimes the standard way of assigning modules to the menu may be not a sufficient solution for your website, particularly if you would like to make any module contingent upon any component's view ( or many other options )
Lets's take dj-classifieds component that is implemented on the demo website of dj-real-estate02 template.

The dj-classifieds component is assigned to "Home" link in the horizontal menu, where "Home" link is a default link item with Itemid = 1.
DJ-Classifieds uses that Itemid to display ads, so the single item of the particular ad is displayed on the front page.

On the other hand, there is also another extension displayed at the front page also - dj2frontpage module that works with dj-catalog2 component.
As a result, taking into account all information above, the dj2frontpage module is displayed each time we click on the ad's details.
It can be very annoying since each time we have to scroll the website to see details. However, there is a simple solution to avoid such discouragement from looking through classified advertisements.

If you use Advanced Module Manager extension, you will get the large variety of assigning options, for example we used the PHP tab only to assign dj2frontpage module on the start page only, but taking into account that ads are also displayed on the front page, we have to find a unique part of URL for start page.
Take a look at the URL of front page:

http://templates.design-joomla.eu/dj-real-estate02/index.php?option=com_djclassifieds&view=show&cid=0&Itemid=1

What is unique here?

The answer is simple -> cid=0

So you have to enter the following code into PHP tab:

if(JRequest::getVar('cid') == '0')
return true;


to get the wanted result.

advanced module manager in Joomla

This is the advanced option, but there are other much easier configuration possibilities to get the result that suits your needs.
For sure you will become convinced that this extension is very useful.