Inserting Headers in Menu

SnapDaddy

Did some more work. The below example is if you only want a given root menus sub-menus to have headers. Other wise, use standard menu.

In my example, I have a root menu item called "Products" (page_id=2) that I wish to use the header text sub-menu.

index.php:

<dl class="nav3-bullet">
   <?php
    $root_name 
show_menu2(1SM2_ROOTSM2_STARTSM2_ROOT|SM2_BUFFER,'[menu_title]''''''');
    if (
$root_name=='Products') {// test for root menu Products
    
                // header text menu - root+1 is header text
        
show_menu2(1'2'SM2_ALLSM2_ALL,'
        [if(level<=1){<ul><li>[menu_title]}]
        [if(level<=1){</li></ul>}]
        
        [if(level>1){<dd>}]
            [if(level==2){<dt>}]
                [if(level>1){[a][menu_title]</a>}]
            [if(level==2){</dt>}]
        [if(level>1){</dd>}]
            '
,'','','');
        
    } else {
        
//standard menu for all other root sub-menus
        
show_menu2(1SM2_ROOT+1SM2_CURR+1SM2_TRIM,'[if(level>0){<dd>}][if(level==1){<dt>}][a][menu_title]</a>[if(level>0){</dd>}][if(level==1){</dt>}]');
        }
    
?>


</dl>

Remember, experience is what you get when you don't get what you want...

SnapDaddy

Here is what I did. I am using a mod version of the Multiflex-3 template. The Multiflex-3 template uses multi menus and <dl> for the side menus.

My top nav (showmenu2 (0)) bar opens with only root menus. The side nav (showmenu2 (1))opens from first sub-menu down with the fist sub-menu being the header text.

It is important to note that if you have sub-menu items, the first sub-menu will be non-linking text (header text).

Menu level <= 1 becomes the header text wrapped in an unordered list for styling.

index.php template file:


<dl class="nav3-bullet">

<?php

show_menu2
(1SM2_ROOT+1SM2_ALLSM2_TRIM,'
   [if(level<=1){<ul><li>[menu_title]}]
     [if(level<=1){</li></ul>}]
                    
      [if(level>1){<dd>}]
        [if(level==2){<dt>}]
          [if(level>1){[a][menu_title]</a>}]
        [if(level==2){</dt>}]
      [if(level>1){</dd>}]
'
,'','','');?>


</dl>


Hope this helps!
Remember, experience is what you get when you don't get what you want...

BerndJM

Hi,

would you share your solution with the community?

Regards Bernd
In theory, there is no difference between theory and practice. But, in practice, there is.

SnapDaddy

#3
Thanks Matthias,

I know there was a way...

The current menu I have displays from the first sub-page down. I would like to have just the first sub-pages be the header text and anything below them be links.

You wouldn't happen to have any examples of how I would use conditions to do this?

OK, got it figured out! Thanks again!

:-D
Remember, experience is what you get when you don't get what you want...

ruebenwurzel

Hello,

make the text headers as parent pages and the other pages as subpages. Use the conditions of show_menu2 (look in readme.txt) to make the parent not as link and style them in your css.

Matthias

SnapDaddy

Hi Bakers,

I would like to break up my menu list (showmenu2) with Text Headers. Is there a way to create these without having to use a bunch of multi menus?

Thanks
Remember, experience is what you get when you don't get what you want...