Monday, May 21st

Last update05:36:30 AM GMT

Font Size

Screen

Profile

Layout

Menu Style

Cpanel
Welcome, Guest
Username Password: Remember me

Joomla mod_mainmenu id issue
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Joomla mod_mainmenu id issue

Joomla mod_mainmenu id issue 2 years, 10 months ago #1816

Hi,

I am relatively new to Joomla, but I've noticed a little issue.

When I create a main menu for the site, joomla outputs an id on the current li named "current". This is ok, no worries. But when I duplicate that menu for the purpose of creating a secondary menu that displays second level items, it also outputs the same id, resulting in a validation error.

"An "id" is a unique identifier. Each time this attribute is used in a document it must have a different value. If you are using this attribute as a hook for style sheets it may be more appropriate to use classes (which group elements) than id (which are used to identify exactly one element)."

Can anyone shed some light on this? I don't understand the thinking behind having a menu output an ID instead of a class, especially when Joomla creators know that people are able to duplicate navigations for the purpose of multiple navigations.

Many thanks.,

Andrew

Re:Joomla mod_mainmenu id issue 2 years, 10 months ago #1817

...
Last Edit: 2 years, 9 months ago by aussie_andy.

Re:Joomla mod_mainmenu id issue 2 years, 10 months ago #1818

  • dex
  • OFFLINE
  • Moderator
  • Posts: 779
  • Karma: 12
Sorry Andy

we're not paid support, we just chip in when and where we can!

I looked at your post this morning and didnt know an answer.

you may well be right.

One possibility is to re-write the menu output code yourself, as a template over-ride for mod_mainmenu. If you are interested in doing this, and need pointers, please reply again.

"current" is indeed used for the selected menu entry, so cant be used as an ID as such.

Can you give us more detail about what you were trying to use this for, and maybe can help further?

Dex
Dex Randall
Joomla! web design and production
Sydney JUG organiser + joomla.org.au site admin
www.spikesystems.com.au
www.twitter.com/dexx

Re:Joomla mod_mainmenu id issue 2 years, 10 months ago #1819

  • austega
  • OFFLINE
  • Senior Boarder
  • Posts: 69
  • Karma: 1
Hi Andrew,

can I clarify what you mean by duplicate the menu item?

If you mean you use the Copy option in the Menu Manager then I do not get the ID duplicated but rather a separate ID (auto incremented from the last menu item I had created).

If you are duplicating the menu item in some other way - is there a reason to do so that I have missed?

Cheers - David
Austega Information Services
m 0415 715 743
w austega.com
w big-issues.org

Re:Joomla mod_mainmenu id issue 2 years, 9 months ago #1820

  • dex
  • OFFLINE
  • Moderator
  • Posts: 779
  • Karma: 12
Hi David

I think Andy means HTML tag <li id="current"> rather than Itemid (menu number)

Dex
Dex Randall
Joomla! web design and production
Sydney JUG organiser + joomla.org.au site admin
www.spikesystems.com.au
www.twitter.com/dexx

Re: Joomla mod_mainmenu id issue 2 months, 3 weeks ago #5842

  • ozneilau
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0
I realise this is an old thread but I came looking for a solution to the OP's question and eventually worked one out.

Note: This may not be the most elegant solution but worked for me and does not involve template overrides or hacking core code.

I also have a website that has a main menu and then a secondary menu in the sidebar. Validation was failing because both menus had the same id:

id="current"

I amended the sidebar menu module parameter from Menu Style = "List" to "Legacy Vertical".

The menu still looks the same but the duplicate id is now gone.

Neil.
  • Page:
  • 1
Time to create page: 0.45 seconds
You are here: Forum