I planned to write this post for quite some time now, but never actually came to writing it. I've got a lot of questions in the past related to our demo site and the menu structure. After I had a look at a customer's website over the weekend only to find around 30 menus with each 1-2 entries in them I decided that it's time to share what I know. And believe me the information that you are going to find is not a secret, but I find an astonishing number of people that don't know about this "trick".
So, If you look at our demo site you'll notice that on the top we have our main navigation and then on the right we have a menu that is related to current page/extension. Here is a screenshot.
How do most people make such menus? They create a main menu, then for each page they create a new menu with the items. So, we have 6 items in our main menu => we'll have to create 6 other Joomla menus. Then we'll have to create 6 modules that would load the different kind of menus that we have and we'll have to assign each module to the correct page. That is how I did it in the past (guilty of charge!), that is how some people still do it. It's a lot of unnecessary work!
Here is how you can do it the easy way:
- You create just one menu! In this menu you put your main navigation items. In our case Home, Hotspots, Ccomment, Matukio, etc. then in the same menu you create submenu items - in our case those are Demo styled map, Demo user location centering etc. The submenus have a parent item, in this example it is Hotspots.
- Here is where the magic comes! You go to the Module manager and create a new module from type Menu then in the Menu options you'll select the Main Menu and you can play with the Start Level and End level options. For our Main menu on the top you can leave the settings as they are.
For our menu on the right, you have to repeat the same steps and at the end you just have to adjust the start level and end level. Set them to 2. This will load only the menus from level 2.
And voila! We are all ready now! No need to create 100 menus, 100 module positions. Just one menu and 2 modules. That's it! You keep an easy structure and you can find where your items are!