views:

27

answers:

1

I want to have a view displayed as a menu either in primarylinks or secondarylinks.

I searched and looked up all modules with no luck.

should I build this functionality manually ==> build a module?

thanks in advance

+2  A: 

Primary and secondary links (in fact, all menus) are rendered as unordered lists of links using a theme function like theme_links(). You can get pretty close to the same functionality by using the HTML List style within a view.

You can't duplicate it exactly because Drupal's menu system requires static menu items: it doesn't handle wildcards like the results of a query.

That is, Drupal's menu system is cached, and is only rebuilt upon request (e.g. by adding a menu item manually, clearing the cache, etc.) A view, on the other hand, is a wrapper to a query: every time you access the view, unless it too is cached, it runs a query to get the latest results.

So, if you were to inject a view into a menu, it'd only be the results at the time of first request, and any subsequent changes would require rebuilding the menu.

The solution I suggested will let you keep the functionality of the view, theme it to look like a menu, and avoid the caveats of the menu system.

Mark Trapp
Injecting a view into a menu, while technically possible, is doing something that the menu system is really not equipped to handle: they menu system expects menu items to be static. Someone is attempting to [integrate Views with the menu system](http://github.com/computerminds/views_build_menu) on GitHub, but I can't speak to its viability: I'd imagine it's very fragile.
Mark Trapp
thanks for the great clarification, I think I learned something from what you said, ok so is there a module to get the results of a view and batch add them to the menu?
Bassel Alkhateeb
let me clear it more, I meant just like a fast tool to add a bunch of items to the menu and let them reside in the menu statically.the Admin can use this tool just to add menu links in a fast manner.
Bassel Alkhateeb