MyBB Community Forums

Full Version: .active for a menu item?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
http://docs.mybb.com/

Like here you see your at the docs page in the menu cause it has a white bg.

How to do something like that?
There is also another solution, quicker and better (don't need to add stuff to body of every page) but needs plugin, which is useful for more things.

1. Get Template Conditionals http://mybbhacks.zingaburga.com/showthread.php?tid=464
2. Change your links from for example:
<a href="portal.php">Portal</a>
To:
<a <if THIS_SCRIPT == "portal.php" then>class="active"</if> href="portal.php">Portal</a>

Or if the link is more advanced (like help documents):
<a href="misc.php?action=help">Help</a>
To:
<a <if THIS_SCRIPT == "misc.php" && $GLOBALS['mybb']->input['action'] == "help" then>class="active"</if> href="misc.php?action=help">Help</a>

Then put active class to global.css and you're done.