I'm trying to set up a directory style listing using views and taxonomy.. so far I've used the following snippet to do it:

http://drupal.org/node/139934

Now that works, and it works great. But unlike the tutorial, I have 3 levels of terms in my taxonomy. I'd like the page to display as in the tutorial, showing only 2 levels of the hierarchy. How would I modify the view so it could take an additional parameter so if I select one of the first-level terms, I see the same summary-style view with the second and third level terms?

What I'm looking for, is (using the tutorial's terms), selecting "Restaurants" then being presented with the following (assuming, of course, that the third level terms did exist):

Pizza (4)
Chicago Style (1), Chain (3)

Oriental (4)
Sushi (1), Japanese (2), Chinese (1)

That seems like it should be straight forward to do, but after toying with views all day, I can't seem to gain any ground.

Thanks for any help!

Comments

riaan burger’s picture

Off hand, change:

  $vid = $view->args[0];
  $tree = taxonomy_get_tree($vid);

to:

  $vid = $view->args[0];
  $tid = ($view->args[1]) ? $view->args[1] : 0;
  $tree = taxonomy_get_tree($vid, $tid, -1, 2);
flndr’s picture

Thats not working for me. It seems that if the second parameter is passed, the callback (phptemplate_views_bonus_panels_byterm_summary) isn't being called. Is there another function I need to implement? Or is it some Views (argument?) thing I can configure from the interface?

But anyway, thanks for your suggestion and quick reply.

riaan burger’s picture

Yikes, OK, I'm out of my depth with this one then.