Welcome, Guest. Please login or register.
Did you miss your activation email?
May 16, 2012, 09:59:09 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155094 Posts in 21661 Topics by 7721 Members
Latest Member: arrow345
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: format menus depending on children  (Read 2420 times)
virgil

Offline Offline

Posts: 177



« on: March 16, 2006, 08:50:49 AM »

Hi everybody

How can I, in the css file i think, format menus differently
depending on the fact if there are children or not.

Let's say I have the following structure:

+ page 1
+ page 2
|  +-- subpage 21
|  +-- subpage 22
|  |     +-- subpage 221
|  |     +-- subpage 222
|  +-- subpage 23
+ page 3
+ page 4
|  +-- subpage 41
|  +-- subpage 42
+ feedback

I would the like to create the formatting the way visitors can see,
like you can see it often in many navigation menues, if there are more
subpages behind a menu point, even if it is not cklicked/expanded yet.

So let's say like this...
(in the example below page 2 is current, pages with subpages are
marked bold, but it could also be another formatting, like a different
background picture/color or other properties...):

+ page 1
+ page 2
|  +-- subpage 21
+-- subpage 22
|  +-- subpage 23
+ page 3
+ page 4
+ feedback

BTW: I use WebsiteBaker 2.6.2. and the original 'show_menu' call (not 'show_menu2')

Do you have any ideas?
Thank you.

Cheers
Virgil
Logged

Virgil - the pre-baked-stuff baker -   wink)
melissa

Offline Offline

Posts: 166


« Reply #1 on: April 05, 2006, 11:52:22 AM »

I noticed this topic had lots of views and no replies, so here is a reply just to encourage you that your post wasn't just ignored.

I was doing a search on show_menu, and I think you may find that you to achieve this, you will need to hack some code, perhaps make a code snippet, that's if you wanted to use show_menu. On the other hand, I think show_menu2 does this out of the box, so to speak.

Did you look at this page - http://forum.websitebaker.org/index.php/topic,2251.msg13978.html#msg13978 - on show_menu?

Quote
* 4. $collapse:    Specifies, whether the menu tree shall be
 *               expandable/collapsible (if set to 'true')
 *               or complete (all pages being displayed) if set to 'false'

Or what about this page - http://forum.websitebaker.org/index.php/topic,2584.msg16207.html#msg16207 - on show_menu2?

Quote
    $aMaxLevel   
        Maximum menu level to display. Menus are displayed from the start
        level down to this level.
            SM2_ALL     No limit, all levels are displayed
            SM2_CURR+N  Always show to the current page + N levels.
                          SM2_CURR      Current (no children)
                          SM2_CURR+3    All parents + current + 3 children
            SM2_START+N Always show from the starting level + N levels. The
                        levels of menu will always be displayed regardless of
                        what level the current page is.
                          SM2_START     Single level of menus from starting level
                          SM2_START+1   Starting level and 1 level down
            SM2_MAX+N   Show at most N levels from the starting level. Levels
                        won't be shown if they are below the current level.
                          SM2_MAX       Starting level only (same as SM2_START)
                          SM2_MAX+1     Maximum of starting level and 1 level.

I can't say I've experimented with this myself, but seems to offer a way to do what you want. Or perhaps by now, you've already found your answer and can share it with us!

Melissa.
« Last Edit: April 05, 2006, 12:03:08 PM by melissa » Logged
virgil

Offline Offline

Posts: 177



« Reply #2 on: April 06, 2006, 08:04:17 AM »

@ Melissa

Thank you for your reply... after missing replies and after your answer I think I didn't succed
in  giving you all the right idea what exactly I was looking for. Here is my new attempt.

Basically it's very simple, imagine you see a collapsed menu (only first level items):

What I now want to see at first glance is which of these menu items have children
and which have not (by formatting them differently... bold/normal, color1/color2,
background1/background2, etc. ...)

In the following example I can see that 'page4' and 'subpage22', even if not expandet
yet, for sure have children. 'Page2' which is now expanded has of course also children
but I knew that also already before clicking on it... I know, my english is not the best,
but I hope I could give you the idea...



+ page 1
+ page 2
|  +-- subpage 21
+-- subpage 22
|  +-- subpage 23
+ page 3
+ page 4
+ feedback


Thank you for any reply.
Cheers
Virgil
Logged

Virgil - the pre-baked-stuff baker -   wink)
melissa

Offline Offline

Posts: 166


« Reply #3 on: April 07, 2006, 02:15:54 AM »

Hi Virgil,

Sorry about that. I understand now what you're looking for. Can't help much though! Maybe someone else will be able to help?

Or perhaps you could find a script on the Internet that takes lists and turns them into nice menus. I'm about to invest in http://www.udm4.com/, but maybe there's something similar for free... With the one I'm looking at, it takes a fully expanded menu in plain html (ul, li, a tags, no formatting) and turns it into a pretty drop-down menu (or similar) menu that will work gracefully in most circumstances.

Melissa.
« Last Edit: April 07, 2006, 02:19:01 AM by melissa » Logged
virgil

Offline Offline

Posts: 177



« Reply #4 on: April 07, 2006, 06:45:50 AM »

Hi Melissa

Thx for y/answer and the hint with UDM4, that sound good.

I would appreciate if you would share your experience with UDM4 with the community.
It seems to be a very valuable alternative to the staticmenues of WB.

Cheers
Virgil
Logged

Virgil - the pre-baked-stuff baker -   wink)
melissa

Offline Offline

Posts: 166


« Reply #5 on: April 08, 2006, 12:59:54 PM »

Just in case anyone was curious, I did find it a bit of a challenge to get this working, ended up writing a bit of code!

Code:
<?php 
// For UDM I have to set: id="udm" class="udm" on the first ul tag
ob_start(); // start output buffer
show_menu(1,0,-1,false,'<li>[a][menu_title][/a]','</li>','<ul>','</ul>','','',0); // call menu
$show_navigation=ob_get_contents(); // put output buffer in $show_navigation
ob_end_clean(); // clear output buffer
// change first <ul> tag to <ul id="udm" class="udm">
// substr_replace ( mixed string, string replacement, int start [, int length] )
echo substr_replace $show_navigation'<ul id="udm" class="udm">'05); 
?>


There it is. Now I just have to go play with the formatting...

Melissa.
Logged
succhi

Offline Offline

Posts: 72


« Reply #6 on: May 07, 2006, 04:24:01 AM »

@Melissa

I know you have got what you want working with the id="udm" class="udm" but if you look at Brodie's show_menu2 you can do what you are after without the hacking. I have given a short description here.

http://forum.websitebaker.org/index.php/topic,2584.msg20067.html#msg20067

Stuart.
Logged
melissa

Offline Offline

Posts: 166


« Reply #7 on: May 08, 2006, 12:08:44 PM »

I'm not so sure. I did give show_menu2 a go. It's such a long time ago now I can hardly remember what was wrong, but I think it adds a class to every item, which mucked up UDM. UDM wants just a plain <ul><li> etc apart from the first one. I think. show_menu2 is such a good thing I thought it would solve all my problems, but turned out to be more fancy than necessary. Happy to be corrected, of course.

Melissa.
Logged
succhi

Offline Offline

Posts: 72


« Reply #8 on: May 09, 2006, 12:45:56 PM »

@melissa

That has been fixed now. Just yesterday.

It was adding 'menu-top' to the class but now by default if you supply your own $aTopMenuOpen then no extra classes are added. It is quite a simple procedure now.

Feel free to check it out if you wish.
Logged
melissa

Offline Offline

Posts: 166


« Reply #9 on: May 13, 2006, 09:07:26 AM »

@succhi, Thanks very much for letting me know. I was very excited about show_menu2, and will definitely give it another go.

Melissa.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!