1
playsome
how to make current menu item active using body id?
  • 2010/11/4 18:12

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hello,

I am having a bit of trouble trying to figure out a particular problem.

I have created a new theme for a clients site and I have navigation tabs just under the header of the theme, I am not using xoops Main Menu.

The navigation tabs will consist of Home, parties, previous parties, about us and gallery.

The site is not very large, about 5 pages so for info that wont be updated much (about us, parties, previous parties) I want to use just one content module and create these pages within the content module.

However I want to have the different menu links highlighted whenever some one is on one of those pages, I can do this if one menu item related to just one module using

#nav-about #content
{
css rules here
}


where #nav-about is the id of the li item of my menu and #content is the body id generated by the module but I cant figure out how to have just one menu item selected for one page of the same module with the same module id, i.e if someone goes to the about us page at modules/content/index.php?id=page1 the about us menu item will be highlighted but so will parties and previous parties because the are on the same module.

Does any one know of a way to make what I am trying to do work?

Thanks


2
ghia
Re: how to make current menu item active using body id?
  • 2010/11/5 2:01

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


In your theme file:
<{if $smarty.get.id == 1}>
#nav-about #whatever
{
css rules here
}
<{/if}>


3
playsome
Re: how to make current menu item active using body id?
  • 2010/11/5 16:59

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


Hi Ghia, thanks for your reply. is the smarty code with the ID referring to the module ID? also can i out the smarty code inside style.css or does it have to go inside theme.html?

Thanks for your help

4
ghia
Re: how to make current menu item active using body id?
  • 2010/11/5 19:15

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


No, to the id of the query part of your example URL.
Yes, in theme.html (or included file) with some (inline) CSS.

5
mariane
Re: how to make current menu item active using body id?
  • 2010/11/6 15:01

  • mariane

  • Theme Designer

  • Posts: 649

  • Since: 2008/1/11


you can use mymenus, a new module created by trabis, easy to use and can make current page highlighted, also you can personalise the skin as you want.
this is a website I did, and I used mymenus in it
www.en.etccenter.org
the road of success is always under construction

6
playsome
Re: how to make current menu item active using body id?
  • 2010/11/7 0:07

  • playsome

  • Not too shy to talk

  • Posts: 197

  • Since: 2009/4/15


ghia, thanks your code worked like a charm, another handy little tip to remember. Thanks.

@mariane, I absolutely love the design of your site, it is very proffesional looking, i especially love the icon links on the top right they look very cool.

7
mariane
Re: how to make current menu item active using body id?
  • 2010/11/8 7:02

  • mariane

  • Theme Designer

  • Posts: 649

  • Since: 2008/1/11


thanks, but did you see the horizontal menu? it's mymenus but I changed the colors to be compatible with the design
the road of success is always under construction

8
biomech
Re: how to make current menu item active using body id?
  • 2013/7/30 13:53

  • biomech

  • Not too shy to talk

  • Posts: 161

  • Since: 2002/2/25


Hi mariane,

I came across this thread in the search for a way to highlight the current page. I've tried using MyMenus, but can't see anywhere to highlight the current page. Is it supposed to do it automatically? Or is it set in the CSS for each link in the menu? I have CSS info included in my link in MyMenus, but it still doesn't highlight when the page is loaded.

I'm using XOOPS 2.5.6.

Any ideas?

Cheers,

- b -

Login

Who's Online

221 user(s) are online (65 user(s) are browsing Support Forums)


Members: 0


Guests: 221


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits