It's my objective to implement a hierarchical website. I've created a view ('view1') which provides me a list of nodes of a special content type. Then I've added the URL to this view to my primary links.

When I click on the link the output of my view1 is displayed and the primary link is marked as active. So far so good.

As soon as I click on one of the listed nodes view1 provides, the primary link isn't active anymore. But I want to keep the primary link marked as active. How can I achieve that? Is this a "problem" of views? Is there any module which offers help? It would be great if someone could help me.

Comments

merlinofchaos’s picture

Status: Active » Closed (works as designed)

This isn't a problem of Views, it's a problem of Drupal's menu system.

By default, Drupal keeps primary links active based mostly upon the URL. There are other ways that are all hardcoded, but in general, what you want is the URL.

So if you have a section named 'cats' and several nodes in that section, you generally accomplish some form of hierarchy by aliasing the nodes to cats/persian, cats/siamese, cats/howly-mad-mean-old-tom

This is a part of Drupal that is very difficult to do properly. I have a blog post about the subject you can find if you google search for the phrase "menu_set_location can eat my shorts" -- which should be enough to tell you that this is a difficult task.

It's also not something Views does or even can do for you.

bjacob’s picture

Thanks for you fast reply. I've set up pathauto in order to get hierarchical urls like the following ones:

content-type_1/node_1
content-type_1/node_1/content-type_2/node_2
content-type_1/node_1/content-type_3/node_3.

Furthermore my view1 is called content-type_1 and I thought Drupal would figure it out and display the menu items as active. The main problem is that I'm building a website where users can create new nodes of the content types _1, _2 and 3. Therefore I've to find a solution which offers me the dynamic I need.

At first I thought maybe it's a problem with my views and the built-in function to create menus...

Can I achieve what I need with the post on your blog?

merlinofchaos’s picture

Well. The core principle I use in that post...yes. But I don't think I explain it very well. I recommend you turn to the forums, though; there are people who've tackled this problem and beaten it. It takes work and it's an ugly place to work in (Drupal's menu code is...well, it was rewritten from scratch for D6. That's how it is =)