WebsiteBaker Support (2.8.x) > Templates, Menus & Design

show_menu2: valid XHTML and CSS selectable menus

<< < (17/64) > >>

succhi:
Hmmm...

I can certainly see from some other posts interest in being able to add css to the first and last element in a submenu/menu and also to the element just before a submenu (collapsed or otherwise) (update: already there as "class='menu-expand'"

<ul>
    <li class="first-li"></li>
    <li class="menu-expand">
    <ul>
        <li class="first-li"></li>
        <li></li>
        <li class="last-li"></li>
    </ul>
    </li>
    <li class="last-li"></li>
</ul>

I'm not sure I have the time and it really is Brodie's code so I don't want to stomp all over it. But I will have a look and see what I can find.

Personally I am looking for a way to do UDM4 style menus without having to pay. Nearly all the nice dhtml solutions are asking for money now. Understandable I guess because they need to stay on top of browser compatibility issues etc. If I code my own one up from scratch I can't actually test it on all browsers so I may just need to invest one day.

Stuart

succhi:
@virgil

You can already add what Melissa wanted using show_menu2. Near the end of the function call is the $aTopMenuOpen varibale and you can pass it '<ul id="udm" class="sitemap udm">' which gives the following only at the top <ul id="udm" class="sitemap udm menu-top">. You don't need the sitemap in there, I just wanted to illustrate the possibilities.

I'm still looking into the start and finish parts so that people can eventually do things like

Home | About | Contact Us

Or other really exciting layouts that need specific handling for start or end elements like borders or colours, images etc.

Stuart

succhi:
OK a quick update on show_menu2 to allow you to track the first and last siblings in a menu/submenu. All first items will have "class='first'" added to the item tags if available, vice versa last items. You will need to add the new flag SM2_FIRSTLAST as shown below.

If you would like to do something like

  Home | About | Contact Us

Try the following with the updated version


--- Code: ---echo "<style> .rootnav span {border-left: solid 1px red; padding: 0 10px;} .rootnav span.first {border-left: none;} </style>";

show_menu2(0, SM2_ROOT, SM2_START, SM2_TRIM|SM2_DESCKEY|SM2_MULTIMENU|SM2_FIRSTLAST, '[a][menu_title][/a]',"<div class='rootnav'>",'</div>','<span>','</span>','',false);
--- End code ---

The updated version I have moved on to 3.0b5. Brodie may modify this if he has a better way to acheive the same thing so please be aware of this when you use this updated version. For instance I have not wanted to change things too much but it might be nice to add some arguments so the naming for 'first' and 'last' can be manually changed. I'm trying to be light handed so Brodie can come back and do what he needs in checking the additions and if the additions are worth keeping.

Stuart

[gelöscht durch Administrator]

brofield:
@succhi
Thanks for the updates while I'm travelling. See my comments below though.

re: SM2_MULTIMENU
I don't see the use for this option. As far as I am concerned you just make multiple calls to show_menu2, once for each menu number that you want to display. It isn't like the number of submenus that are used in a site changes regularly. Feel free to enlighten me as to why this would be a good feature to have.

@virgil
why not just use multiple calls to show_menu2 as above?

@succhi
You can't stomp all over the $wb->extra_where_sql member variable as I don't own it. You always want to use this SQL unchanged (to remove hidden, private, etc pages). Additionally, the results of the database query are cached using the menu number as one of the keys, so you can't do the query this way. The query is done only once on the first call to show_menu2 for that menu. You're current update will cause problems for subsequent menu displays if it was the first call. If it wasn't the first call then your changes won't help. Loading all of the menus into the in-memory cache at one time will require a larger rewrite than that. I can't do this at the moment (travelling), nor as mentioned above can I see a good requirement for it.

re: SM2_FIRSTLAST
@succhi
If you want to get rid of the SM2_FIRSTLAST flag so that all menus generate the classes for the first and last sibling of every list, then I'll make it a standard feature. However, please rename the class names to "menu-first" and "menu-last" to maintain consistency with all other class names. No arguments are required to change the class names - CSS selectors can be used to identify items in specific menus.

Regards,
Brodie

virgil:
Hi Brodie, welcome back


--- Quote from: brofield on May 08, 2006, 08:00:39 AM ---
... SM2_MULTIMENU: I don't see the use for this option.
As far as I am concerned you just make multiple calls to show_menu2,
once for each menu number that you want to display...

@virgil
why not just use multiple calls to show_menu2 as above?
--- End quote ---


--- Quote ---Feel free to enlighten me...
--- End quote ---

... well, I give it a try: :roll:

I do NOT want to call for multiple menus... I WANT the sitemap to show ALL PAGES,
no matter which menu they are assigned to, but this did NOT WORK, until succhi's
SM2_MULTIMENU option. Let me try to explain again:

Lets say I have 2 menu blocks both independent from each other (menu1, menu2):
1.) one vertical menu on the left
2.) one horizontal top menu

When I place the sitemap menu link on the top menu, the sitemap shows only the
entries of the top menu, but not of the left menu. :-(

When I place the sitemap menu link on the left menu, the sitemap shows only the
entries of the left menu, but not of the top menu.  :-(

But I want, no matter where I place the menu link... tha the sitemap shows me ALL
PAGES of my site, no matter if they are assigned to the left or to the top menu...
and that's exactly what the SM2_MULTIMENU option made possible.  :-D :-D :-D

I hope I was able, despite my linkish english, to express what I mean!  :wink:

Cheers,
Virgil

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version