Author Topic: a:current?  (Read 6144 times)

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
a:current?
« 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?
Kind regards,Irene

Offline Bramus

  • Posts: 608
  • Gender: Male
    • BRAMUS Internet Services
Re: a:current?
« Reply #1 on: March 13, 2010, 05:40:44 PM »
wasnt this menu-current?
BRAMUS Internet Services

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #2 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


"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #3 on: March 13, 2010, 05:55:37 PM »
gonna try ! Thanks, guys, let you know!
Kind regards,Irene

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #4 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
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #5 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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #6 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,

?
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #7 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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #8 on: March 14, 2010, 04:16:32 PM »
yeah that's right!
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #9 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.
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #10 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.
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #11 on: March 14, 2010, 04:34:06 PM »
It still shows the children, we should make them appear on click...
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #12 on: March 14, 2010, 04:40:15 PM »
Hello Irene,

this should solve your child-items problem:

replace $aItemOpen, with the following:

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

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

"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #13 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?
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #14 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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #15 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!



Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #16 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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current? | menu disappears now and then
« Reply #17 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/
Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #18 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 = &#39;<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current){ class="active"}]>[menu_title]</a>&#39;,

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

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
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Ogierini

  • Posts: 276
  • Gender: Female
  • Gebruikersvriendelijkheid staat voorop!
    • www.twitter.com/irene_ogier
Re: a:current?
« Reply #19 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!





Kind regards,Irene

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: a:current?
« Reply #20 on: March 16, 2010, 04:04:24 PM »
You're welcome!

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden