Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 04:11:24 AM

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.
149621 Posts in 21098 Topics by 7537 Members
Latest Member: lotte2
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: a:current?  (Read 909 times)
Ogierini

Offline Offline

Posts: 269



WWW
« 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?
Logged

Kind regards,Irene
Bramus
Forum Team
*****
Offline Offline

Posts: 600


WWW
« Reply #1 on: March 13, 2010, 05:40:44 PM »

wasnt this menu-current?
Logged

BRAMUS Internet Services
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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:
<?php 
  show_menu2

    
$aMenu   0,
    
$aStart SM2_ROOT,
    
$aMaxLevel SM2_CURR+1,
    
$aOptions SM2_ALL,
    
$aItemOpen '<li [if(class==menu-current){class="active"}]>[if(class==menu-current) { [a]<span>[menu_title]</span>} else {[a][menu_title]}]</a>',
    
$aItemClose '</li>',
    
$aMenuOpen '<ul class="mymenu">',
    
$aMenuClose '</ul>',
    
$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


Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« Reply #3 on: March 13, 2010, 05:55:37 PM »

gonna try ! Thanks, guys, let you know!
Logged

Kind regards,Irene
Ogierini

Offline Offline

Posts: 269



WWW
« 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
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« Reply #6 on: March 14, 2010, 04:04:53 PM »

Thanks Stefek, IT WORKED!  grin

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,

?
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« Reply #8 on: March 14, 2010, 04:16:32 PM »

yeah that's right!
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« Reply #9 on: March 14, 2010, 04:17:09 PM »

In that case, use the following CM2 call:

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

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


This should do the trick.
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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.
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« Reply #11 on: March 14, 2010, 04:34:06 PM »

It still shows the children, we should make them appear on click...
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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 '<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

Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« Reply #13 on: March 14, 2010, 04:48:52 PM »

Hi Stefek,

That helps, the logo only appears with the parents. cheesy

Only the children shouldn't be visible at the start, only at click. Should I change their css?
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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 wink

Kind regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« 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!



Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« 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/
Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« 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 '<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 wink

R,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Ogierini

Offline Offline

Posts: 269



WWW
« 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!





Logged

Kind regards,Irene
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4753



« Reply #20 on: March 16, 2010, 04:04:24 PM »

You're welcome!

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
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!