The importance of the menu item in the functioning of Joomla!
In this article we will explain the importance of the menu item in the functioning of your Joomla! website.
If there' s anything essential in Joomla, it's the menu link! To better understand its importance, here is a small computer graphic that shows very schematically what happens when an article is called up in Joomla! [To simplify, we have removed the management of languages and other small details...]
The call of the content
This one is far from going in a brutal azimuth, it will glean on its way the different elements that will constitute the page. Because as you know, the pages of your website do not exist as such, but are constituted when they are called up
If I call up the updated page of my website, via a category blog type menu link, set to display one full-width article and two introductions, displayed by date, the last three articles will be displayed on the page. But if I only have two articles available, the page will only display two articles. This is a miracle of the CMS which builds pages according to my request and to what can answer it !
One call, serval possibilites
There are three possible scenarios :
There is a menu link
There is a related menu link
There is no menu link
In case A, the call is made directly through a menu link and we therefore have the so-called itemid. This is the unique numerical identifier of the menu link in the database. Joomla will then look for what is assigned to this menu link: template, modules, etc.
In case B, the call is made by a read more for example. Since there is no itemid at the start of the call, Joomla will search for a menu link in the database to the called item, or even a link to the item's category. As there is a "news" menu link which leads to this category, Joomla will therefore look for what is assigned to this menu
In case C, we have neither a menu link at the beginning, nor a related menu link. So what will Joomla do? The answer is simple: it will use the original ItemId of the page where the click occurred! Joomla will therefore display the article in the page layout that is the one of the call page.
This explains why my pretty slider module, which is only assigned to the home page, is still there when you click on the read more article on the home page. This article and its category are not served by another menu link: Joomla remains in the existing layout when clicked.
On the way to the page rendering
- Click from: A a menu link, B a read more with a related menu link or C a list of items.
- The database is queried.
- Retrieve the template assigned to the ItemId.
- Extract the module publication positions from the template.
- Retrieve the published modules, with verification of rights, on this ItemId.
- We retrieve the content of the article, with verification of the reading rights.
And we display the page as it should be.
How can this problem be solved ? It's very simple, by creating a menu link to the category in a menu different from the main menu, a menu which may not be displayed and which is only used to manage module and template assignments.
Photo de Clem Onojeghuo provenant de Pexels