As you may know already there is an option in Joomla! 1.5 to create one menu tree but show different levels on different places in your template, a so called splitmenu.
Suppose you have a menu tree with 4 top level menu items, I call those level1 menu items. To make things more clear we refer to that menu as the horizontal main menu above a site.
For each or some of those menu items you create a couple of sub-menu items which I call level2 menu items. This will be the sub-menu that appears in the left sidebar for example after one of the level1 (horizontal top-menu) menu items is clicked.
In the Joomla! module admin you have a menu module for your level1 horizontal menu which you should edit to make it render only the 4 level1 menu items. There are some parameters on the right where you can set which level the menu should show on the front-end of the site (see image above Start Level = 0 and End Level = 1).
Now when you make a copy of that menu module and publish it on another module position, you should change those same parameters (see image above but Start Level = 1 and End Level = 2) to have the module only render and show the level2 sub-menu items for a level1 main-menu item.
I encountered problems with the splitmenu feature and the "countModules()" template function you can use in your Joomla! templates to show or hide certain html.
The problem is that this function checks whether a module is set to be published on a position in your template file but a sub-menu module is set to always be published but it doesn't always have data to display.
When there are no level2 sub-menu items for a certain level1 main-menu item you should be able to hide the module completely so you don't end up with an empty module div or a module title without data beneath it.
After telling this problem to Sam Moffatt, one of the core coders he understood and we considered this to be a bug in the splitmenu functionality of Joomla! 1.5 that should and could be fixed.
From Joomla! 1.5.7 you will have a new function to use in your templates and the function is:
<?php if ($this->countMenuChildren()){ ?>
<div class="sidebar-left">
<jdoc:include type="modules" name="level2_menu" style="raw" />
</div>
<?php } ?>
So when you are using the splitmenu feature in your template you can now hide html based on whether a level1 menu item has children or not even if the module itself is set to be published for all menu items. This is a great improvement for template designers like myself.
# 2 - Posted by: Johan Janssens on 2008-09-19 10:47:10
Some more discussion on this new function and proposals for alternate solutions can be found here : http://forum.joomla.org/viewtopic.php?f=466&t=326117&start=0&st=0&sk=t&sd=a
# 3 - Posted by: Mario Lopez on 2008-11-15 15:49:37
Thanks a lot!!!
I've been surfing, trying to get a solution to implement an horizontal submenu.
More than 8 hours looking for a hint, and you've just show me the truth!!
Thanks mate :-D
Regards
# 4 - Posted by: Jikke on 2009-05-28 08:39:04
Hi, excellent article and exactly what I was looking for!
It works beautifully with menu style 'list'. However, I tried it with horizontal legacy and it's not working. It's showing all menu items for the level1 and level2 menu.
Any suggestions would be greatly appreciated!
Jikke
# 5 - Posted by: koorosh on 2009-07-19 14:34:44
Hello Dear Friend,
I want to learn about joomla programming sourse code, specially about joomla Fonctions as JFactory, ...
Please help me.
Sincerely
Koorosh
Help for creating beautiful comments.
Please read this help text and use it when you post a comment.
You can use the following html in your comment:This is the first paragraph of your comment
This is the second paragraph of your comment and this text will be bold.
This is the third paragraph of your comment and this text will be italic.
Thanks
In Joomla! land there are a couple of ways to built your website and I'm talking about the template specifically. Now...
One of the most forgotten or ignored "features" of a website is the print page. Many times...
The Joomla Project is pleased to announce the immediate availability of Joomla 1.5.7 [Wovusani]. This...
As you may know already there is an option in Joomla! 1.5 to create one menu tree but show different...
For professional Joomla! consultancy and development visit Alvaana.com
Copyright 2008 The Woof and The Warp - Arno Zijlstra
Re: Interaction
# 1 - Posted by: Robin Muilwijk on 2008-09-10 08:52:10
Good to see that interaction of professional users lead to such a solution (fix). I'm a big fan and user of the split menu's, this makes it even more powerfull.