[development] Highlighted tabs, primary links, and bread crumbs
Yves CHEDEMOIS
y.chedemois at free.fr
Tue Mar 28 21:26:21 UTC 2006
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
Nic Ivy a ecrit le 28/03/2006 22:29:
> I'm working on a new site for which I am using primary links (i.e.
> menu items) as tabs across the top of each page to describe different
> areas. It would be nice if I could visually segregate content into
> the different areas by highlighting the correct tab.
>
> i have several thousand pieces of content, and the number is growing.
> If I simply defined menu items for each node, I expect performance
> would diminish as the size of $menu increased.
>
> Other people have tried to accomplish this highlighting trick using
> hacks and kludges (e.g. http://drupal.org/node/46020). I have done
> the same until now. But for some reason, PHP in page.tpl.php does not
> have access to the current page's query string or bread crumbs. This
> seems to be a recent change in HEAD.
>
> So, to determine which tab to activate, I am comparing in page.tpl.php
> the supplied bread crumb links with the supplied primary links. When
> there is a match, I activate the primary link so the tab looks
> highlighted.
>
> But how can I define arbitrary bread crumbs for a large number of nodes?
>
> Is there a better way to do this? Has anyone else done this?
>
> Nic
>
>
More information about the development
mailing list