[development] Highlighted tabs, primary links, and bread crumbs
Nic Ivy
nji at njivy.org
Wed Mar 29 15:39:14 UTC 2006
I got it to work. Here's how:
Taking Yves' suggestion, I created a module whose sole purpose is to
mangle the global $_menu during the 'view' phase of hook_nodeapi().
This code uses a lookup table in order to adjust the parent-child
relationships between the current node and the desired primary link.
In this way, the desired primary link (i.e. menu item) becomes part
of the active trail.
In page.tpl.php, the key for the $primary_links indicates which menu
items are in the active trail. So after a quick strpos() check, the
proper primary link is highlighted.
So I got what I need out of this and do not intend to publish the
module. It is very rough around the edges. If someone else wants to
take this code and polish the UI, I will give you what I have. Write
to me off-list.
Nic
On Mar 28, 2006, at 3:26 PM, Yves CHEDEMOIS wrote:
> As for theming : the way the arrays $primary_links and
> $secondary_links are built can help you on that.
> While the values of the array contains the html for the links, the
> _keys_ give you information on
> which item is "active". That is much better than comparing
> breadcrumbs pieces to primary links.
>
> You still have to attach your content one way or another to the
> menu hierarchy.
> The 'menu_set_location' in menu api has precisely that purpose. But
> being an api function,
> using it requires, well, coding...
>
> Meaning, if you are a coder, it should be rather simple to
> build your own classification code in a small dedicated module and
> attach your content to the right
> menu trail 'on the fly' on each page display (in hook_menu)
>
> If you're not, or if you want full fledged features, then
> category.module is your friend.
>
> Yves
More information about the development
mailing list