joomla 3.2 generates item ids as css classes in the html output of e.g. menu elements, is this of any use to me or just ignore it?

StackOverflow https://stackoverflow.com/questions/20097966

  •  03-08-2022
  •  | 
  •  

Question

I am used to develop simple, e.g. leave away whatever you don't need. This is why I have a bit a hard time with projects like joomla, because they ship with a lot of things I don't know what it should be good for. Someone knows why these classes are added to the elements? are they of any use to me?

an example of the generated item ids that are added

Was it helpful?

Solution 2

As @Mark Simpson said, they're not actually used.

If you wish to remove them, go to line 25 of modules/mod_menu/tmpl/default.php and you will find this:

$class = 'item-'.$item->id;

which you can simply change to:

$class = '';

Do note that if you do edit this file, it may get overridden in a Joomla update and thus your changes will be lost. So instead of editing this core file, make a template override

OTHER TIPS

The cms doesn't use them. Those are just helper classes, there for the benefit of template designers and site builders.

Say you want to highlight a particular menu item by giving it a different color. You could do this:

.item-435 a {color: red} /* turn that particular menu item red */
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top