WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: Ogierini on March 13, 2010, 05:09:49 PM

Title: a:current?
Post by: Ogierini on March 13, 2010, 05:09:49 PM
Hi

I have a question about the menu css.
I would like to have a hover, no problem. But than as well I would like on the active page, the page you visite a t that moment: a little symbol appears in the menu.
It can't be a:visited because when visited al pages have the symbol in the menu.
I thought a:current but it doesn't exist?

Can someone help out?
Title: Re: a:current?
Post by: Bramus on March 13, 2010, 05:40:44 PM
wasnt this menu-current?
Title: Re: a:current?
Post by: Stefek on March 13, 2010, 05:51:30 PM
Hello Irene.

You'll need to apply the css class to these List Items or to the A Tags of the current pages.

See the example ( by $aItemOpen):
Code: [Select]
<?php 
  show_menu2

    
$aMenu   0,
    
$aStart SM2_ROOT,
    
$aMaxLevel SM2_CURR+1,
    
$aOptions SM2_ALL,
    
$aItemOpen = &#39;<li [if(class==menu-current){class="active"}]>[if(class==menu-current) { [a]<span>[menu_title]</span>} else {[a][menu_title]}]</a>&#39;,
    
$aItemClose = &#39;</li>&#39;,
    
$aMenuOpen = &#39;<ul class="mymenu">&#39;,
    
$aMenuClose = &#39;</ul>&#39;,
    
$aTopItemOpen false,
    
$aTopMenuOpen   false
  
);
?>


This is just a example.

You also can use the standard SM2 behaviour, as roposed by Bramus in the post above.

However, you should read the SM2 documentation in order to fully understand this topic.

Kind Regards,
Stefek


Title: Re: a:current?
Post by: Ogierini on March 13, 2010, 05:55:37 PM
gonna try ! Thanks, guys, let you know!
Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 03:42:39 PM
Ai doesn't work yet.

If you klick the logo appears but it should only appear when it is the page in question

http://www.idealcooking.nl/cms
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 03:56:28 PM
Dear Irene,

you did it right.
You only forgot your css file.

Change/Expand the following selector:

#nav li a:hover {

to:
#nav li a:hover,#nav li.active a {

and you'll get there..

Kind Regards,
Stefek
Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 04:04:53 PM
Thanks Stefek, IT WORKED!  :-D

There is just 1 minor thing left: the "#nav ul ul li" are shown in the menu, while I want them only to be shown when clicked on the "#nav li"

Can I delete the _ROOT from:   $aStart         = SM2_ROOT,

?
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 04:11:28 PM
Do I understand right, you want this behaviour only for the parents, not for its childs?

R,
Stefek
Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 04:16:32 PM
yeah that's right!
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 04:17:09 PM
In that case, use the following CM2 call:

( only $aItemOpen changed):
Code: [Select]
<?php 
  show_menu2

    
$aMenu   0,
    
$aStart SM2_ROOT,
    
$aMaxLevel SM2_CURR+1,
    
$aOptions SM2_ALL,
    
$aItemOpen = &#39;<li [if(level==0 && class==menu-current){class="active"}]>[if(class==menu-current) { [a]<span>[menu_title]</span>} else {[a][menu_title]}]</a>&#39;,
    
$aItemClose = &#39;</li>&#39;,
    
$aMenuOpen = &#39;<ul class="mymenu">&#39;,
    
$aMenuClose = &#39;</ul>&#39;,
    
$aTopItemOpen false,
    
$aTopMenuOpen   false
  
);
?>


This should do the trick.
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 04:30:40 PM
No, wait.

This is not right.
I'll take a look further into it....

just wait a second.
Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 04:34:06 PM
It still shows the children, we should make them appear on click...
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 04:40:15 PM
Hello Irene,

this should solve your child-items problem:

replace $aItemOpen, with the following:

$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current){ class="active"}]>[menu_title]</a>',

then, change your selector name

#nav li.active a  .mymenu li a.active {
   color: #efaf0f;
   background-image: url(images/logomenu1.png);
   background-repeat: no-repeat;
   background-position: left center;
}


Will do the trick.

Let me know.
Regards,
Stefek

Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 04:48:52 PM
Hi Stefek,

That helps, the logo only appears with the parents. :lol:

Only the children shouldn't be visible at the start, only at click. Should I change their css?
Title: Re: a:current?
Post by: Stefek on March 14, 2010, 05:15:57 PM
I see..

you need to specify this in the $aOptions Parameter.

Please try flag SM2_TRIM instead of SM2_ALL.

There are infinite possibilities with show_menu2.
Consider to read the manual / help file ;-)

Kind regards,
Stefek
Title: Re: a:current?
Post by: Ogierini on March 14, 2010, 05:30:39 PM
You are fantastic,
Thank you very much.

It wasn't lazyness... I just don't see the solution. But the more you try the more it seems to be logic.

anywell, Thanks a lot!



Title: Re: a:current?
Post by: Stefek on March 14, 2010, 05:50:38 PM
But the more you try the more it seems to be logic.

That's right, Irene...

I am glad that I was able to help you out with this.

Regards,
Stefek
Title: Re: a:current? | menu disappears now and then
Post by: Ogierini on March 16, 2010, 02:34:59 PM

Maybe the site is tired.... but all of a suddon the menu disappears now and then.
When you click throu the website sometimes it's gne, and after clicking F5 it appears again, but that's a bit balen....

http://www.idealcooking.nl/cms/
Title: Re: a:current?
Post by: Stefek on March 16, 2010, 03:16:17 PM
Hello Irene,

I cant't help you with this, because I can't reproduce this bug on my browser.


But I have another hint for your show_menu2 call.

Change:
$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current){ class="active"}]>[menu_title]</a>',

into:
$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current || class==menu-parent){ class="active"}]>[menu_title]</a>',

In this case, the "icon/logo" will show in the menu on the parent, when it's child is active.
I have overseen this before.

Try it out and let me know if you like it ;-)

R,
Stefek
Title: Re: a:current?
Post by: Ogierini on March 16, 2010, 03:32:06 PM
Yes,
 this is beautifull thank you!
I haven't seen the disapear thingie again. Strange but fortunate!

Well thanks again for your help!





Title: Re: a:current?
Post by: Stefek on March 16, 2010, 04:04:24 PM
You're welcome!

Regards,
Stefek