Vanilla open source was terminated 1 January 2025 by Higher Logic. See this announcement for more information.
Can I add a class to the top navigation items?
In the default.master.tpl the nav is built using a bunch of Smarty tags like: {activity_link}
Is there a way I can add a class to these? Where is the HTML that renders them located?
0
Best Answer
-
Kasper Vanilla Staff
The
format
attr. can be used for this:{activity_link format="<li class="Activity"><a href="%url" class="%class">%text</a></li>"}
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
6
Answers
@jbregar
It would probably be easier if you said what you hoped to achieve.
I need to style those links with icons next to them. Right now those smarty calls just spit out
<li><a href="...">Link Text</a></li>
. Therefore putting a different icon to the left of say "Discussions" than "Inbox" is going to be difficult if not impossible. It would be ideal if I could add a class to each of the li or a tags that are created so I could key off of them.The
format
attr. can be used for this:Source: https://github.com/vanillaforums/Garden/blob/master/library/vendors/SmartyPlugins/function.activity_link.php
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub