xoops forums

playsome

Not too shy to talk
Posted on: 2010/11/4 18:12
playsome
playsome (Show more)
Not too shy to talk
Posts: 197
Since: 2009/4/15
#1

how to make current menu item active using body id?

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

ghia

Community Support Member
Posted on: 2010/11/5 2:01
ghia
ghia (Show more)
Community Support Member
Posts: 4946
Since: 2008/7/3 1
#2

Re: how to make current menu item active using body id?

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

playsome

Not too shy to talk
Posted on: 2010/11/5 16:59
playsome
playsome (Show more)
Not too shy to talk
Posts: 197
Since: 2009/4/15
#3

Re: how to make current menu item active using body id?

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

ghia

Community Support Member
Posted on: 2010/11/5 19:15
ghia
ghia (Show more)
Community Support Member
Posts: 4946
Since: 2008/7/3 1
#4

Re: how to make current menu item active using body id?

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

mariane

Theme Designer
Posted on: 2010/11/6 15:01
mariane
mariane (Show more)
Theme Designer
Posts: 649
Since: 2008/1/11
#5

Re: how to make current menu item active using body id?

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

playsome

Not too shy to talk
Posted on: 2010/11/7 0:07
playsome
playsome (Show more)
Not too shy to talk
Posts: 197
Since: 2009/4/15
#6

Re: how to make current menu item active using body id?

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.

mariane

Theme Designer
Posted on: 2010/11/8 7:02
mariane
mariane (Show more)
Theme Designer
Posts: 649
Since: 2008/1/11
#7

Re: how to make current menu item active using body id?

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

biomech

Not too shy to talk
Posted on: 2013/7/30 13:53
biomech
biomech (Show more)
Not too shy to talk
Posts: 161
Since: 2002/2/25
#8

Re: how to make current menu item active using body id?

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 -