WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: CodeALot on March 05, 2009, 11:42:38 PM

Title: show_menu2 and menu_current
Post by: CodeALot on March 05, 2009, 11:42:38 PM
Edit: Ok, my initial question was too complicated I think. No suggestions whatsoever :)

Before you read on, here's my question in a nutshell: How does the MENU (and NOT the described function!) in this page work? How is it 'called'?
http://code.jellycan.com/sm2test/pages/conditional/show-only-siblings.php
I want what's happening there. Color the parent, color the active sibling. And that in a horizontal menu :)
 
I mean... I LOVE the show_menu2 functions, but it comes with about the worst possible documentation. I just want to know how to pass a class to an active page, AND the active PARENT of that page. I've tried and tried, see code below, and I can't get it to work.

Yes, it's pretty fair to say I'm getting quite desperate here.


I have:
5 menu "parents",
Each parent has 5 "child" pages.
 
I managed to get show_menu2 to show me both the parents and the children, in two seperate horizontal menu's. Each item seperated by a |  symbol. Wonderful :)

Code: [Select]
       show_menu2(0, SM2_ROOT, SM2_START, SM2_PRETTY, ' |   [a][menu_title]</a>', '', '', '', '[a][menu_title]</a> ');
        show_menu2(0, SM2_ROOT+1, SM2_START, SM2_PRETTY, ' |   [a][menu_title]</a>', '', '', '', '[a][menu_title]</a> ');

This works. If I click parent 1, I see the 5 children of that page in the second invocation of show_menu2. Great.
Now, what I want, is to have the menu_current class active on the ACTIVE parent-title _and_ the ACTIVE childpage-title.

All links in both "Parent" and the "Child" menu are white. Active pages should appear black in the menu.

So, if I click Parent-1, and then Child-4, I want the Child-4 page to show up (which it does) and have the Parent-1 and Child-4 to appear in black.

This is the CSS I used so far:
Code: [Select]
.menu a:link, .menu a:visited, .menu a:active {
    text-transform:uppercase;
    color:#ffffff;
    padding:8px; text-decoration:none;
}
.menu a:hover {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;

}

.menu_current a:link, .menu_current a:visited, .menu_current a:active {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;

}
.menu_current a:hover {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;

}

Can anyone help me out? Please? Very please?

I'd give you a live URL, but this is a project that's still only active on my local webserver...

Thanks in advance. Anyone. Please. Did I say please already? :)
Title: Re: show_menu2 and menu_current
Post by: CodeALot on March 06, 2009, 11:31:58 AM
The guy that comes up with an easy to use Show_menu3 will be nominated for the Nobel Prize. This thing is giving me a splitting headache.  :oops:
Title: Re: show_menu2 and menu_current
Post by: erpe0812 on March 06, 2009, 12:28:18 PM
Despite what you said, a link would be helpful.
Is it not possible, to set this one on a live server?

rgds

erpe
Title: Re: show_menu2 and menu_current
Post by: CodeALot on March 06, 2009, 01:10:35 PM
Thanks for your reply, Erpe,

I build the site using a local webserver, pointing the actual URL to my 127.0.0.1. That way I can use all site-paths as if they were live. My client already has a webserver on the domain I'm using so I can't upload it to its live-environment yet...

Maybe a schematic display of what I want?

HOME  |   ARRANGEMENTS   |    ROOMS

This is "level 1", it's the top horizontal menu. Now, if I click ROOMS, it looks like this:

HOME  |   ARRANGEMENTS   |    ROOMS
SINGLE  |   DOUBLE   |   SPECIALS

The second line (Single/Double/Specials) is a second invocation of the menu.
By clicking ROOMS in the top menu, the page SINGLE will be the first to load. So, the site is showing the SINGLE page. This all works great.

What I want now, is to have ROOMS and SINGLE be "lit up" in a different color than the other menu-items.

The CSS I use for this is:
Code: [Select]
.menu a:link, .menu a:visited, .menu a:active {
    text-transform:uppercase;
    color:#ffffff;
    padding:8px; text-decoration:none;
}
.menu a:hover {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;
}

.menu_current a:link, .menu_current a:visited, .menu_current a:active {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;
}

.menu_current a:hover {
    text-transform:uppercase;
    color:#000000;
    text-decoration:none;
}

The two menus (top level and the second horizontal menu) are invoked using:

Code: [Select]
show_menu2(0, SM2_ROOT, SM2_START, SM2_PRETTY, ' |   [a][menu_title]</a>', '', '', '', '[a][menu_title]</a> ');
show_menu2(0, SM2_ROOT+1, SM2_START, SM2_PRETTY, ' |   [a][menu_title]</a>', '', '', '', '[a][menu_title]</a> ');

I have built site having the "current" page light up the right way in the menu, but never on two levels at the same time. Above that, I can't even get ROOMS (in the above example) to light up, so I assume there's something in the two "show_menu2" invocation lines that should be altered... But what?
Title: Re: show_menu2 and menu_current
Post by: erpe0812 on March 06, 2009, 01:30:27 PM
I understood what you want, but it is easier to develop/test it with a live link and firebug.

If you click as you described, SINGLE is current (but in ul li ul li) and ROOMS is parent (in ul li), but it depends on the formatting of the rest of the menu and of the menu-items. Is ROOMS created as a menu-link? So if not, SINGLE would be child referring to ROOMS.

Spo you see, it is really easier if we got a link.
Have a look at your html output code and see, which classes the menu items have, and format them in order of appearence.

rgds

erpe

 
Title: Re: show_menu2 and menu_current
Post by: CodeALot on March 07, 2009, 01:35:45 PM
Hi Erpe,

Thanks again for your reply :)

If I check the source code, I see two instances of the menu. The ROOMS link is not a MENU-LINK but a stand-alone page, with the child-pages SINGLE / DOUBLE / SPECIALS.

If I click the ROOMS link, it gets class "menu-expand menu-current menu-last"
(It is the last link in the top-menu)

I suppose I should define .menu-current in my CSS, and I did that, but that doesn't seem to work.

Oh well... I guess I'll have to make a live-situation somewhere.
Thanks for trying anyway ;)
Title: Re: show_menu2 and menu_current
Post by: erpe0812 on March 07, 2009, 01:50:54 PM
A live demo would be fine.

rgds

erpe