Anyone have advice on how to set up views to show as tabs on node types with pathauto rewrites?

Here's my situation: I've got a CCK type projects aliased using pathauto so that all project nodes have paths of the form

projects/[title]

I also have a view of all the terms from a specific taxonomy that I want to display. The view provides a page as a tab with the path

projects/$arg/technologies

The arg uses a php rewrite to transform the [title] from the pathauto into a [title] of the form that views expects (views uses %20 etc, pathauto uses "-" substitution).

When I go to a url of the form projects/project-name/technologies, the list shows up fine.

The problem is that there's no tab on the projects/project-name page for the view. I'm guessing this is because view or the menu system is looking at the actual path of the node (in this case node/id) in order to determine what tabs to display, not at the path aliases.

Is there any way to make the tabs displayed depend on the path alias as well as the "true" path of the node? Is there a different solution?

Thanks.

Ethan

Comments

ethanw’s picture

when in doubt...turn to IRC. merlinofchaos rocked this issue in a bout 30seconds. unfortunately there's no easy way to take care of it....which makes sense since the menu system is pretty deep and does what it's going to do. Any changes to it are either gross hacks or implementations of the API.

to solve this issue, merlin recommended i make a module with a menu hook that created the tab menus for nodes only of acertain type. at some point a may break this out into a utility module of sorts, but for now here's the code:


  if ($maycache) {
    
  } else {
    if (arg(0) == 'node' && is_numeric(arg(1))) { 
      $node = node_load(arg(1)); 
      if ($node->type == 'project') { 
        $items[] = array(
          'path' => (arg(0) . '/' . arg(1) . '/technologies'),
          'title' => t('Technologies'),
          'callback' => 'views_page', 
          'callback arguments' => 'project_technologies_list',
          'type' => MENU_LOCAL_TASK
        );
      }
    }

--
ethan winn
http://www.destratify.com/

--
ethan winn
http://colab.coop