Is Taxonomy Menu compatable with Views ?

I would like to use Views to change the output of Taxonomy Menu, I tried using URL: taxonomy_menu but this doesn't seem to work, any ideas?

Keith

Comments

iancawthorne’s picture

I'm looking for the answer to this question too.

Taxonomy menu creates its own pages eg: http://www.yourdomain.com/taxonomy_menu/1/3

but standard taxonomy uses the path: http://www.yourdomain.com/taxonomy/term/1/3

Views can override the standard taxonomy pages, but I haven't found a way of doing this for the taxonomy menu pages. Surely there must be a way to do this.

sjnorton’s picture

Likewise, I'd like to be able to change the sort order of node listings generated by Taxonomy Menu without resorting to hacking the taxonomy module directly. The Views module seemed just the thing, but I could find no way to make it affect listings generated via taxonomy_menu. Any help appreciated!

waltWright’s picture

I am also having a similar issue. I added both Taxonomy Menu and Taxonomy breadcrumb modules. It seems like a very logical expectation that some menu items within the taxonomy menu should be overridden and NOT go to the taxonomy default page. For example, if I define a book, I would want to redirect the menu item (term) to the book root. Instead, we get all of the nodes affiliated with the book (because they all refer to the term). I'm hoping that a view can allow more control, but haven't figured out how to integrate it or if it possible using Taxonomy Menu.

gmayes’s picture

I too would be very interested in a solution to this.

I'm thinking of configuring the "taxonomy/term" view to my taste, and then editing taxonomy_menu.module so that the URL maps to taxonomy/term/* instead of taxonomy_menu/*. This way I can control the "view" and also have menu links for terms created automatically. The only issue I see (so far) in my cursory testing is that taxonomy/term uses a depth of 0 and taxonomy_menu has an unlimited depth, but hopefully this is an easy fix.

Thoughts?

gmayes’s picture

Sorry all, I gave up. Here's what I tried:

1. Change the "taxonomy_menu/*" $path in taxonomy.module to use "taxonomy/term/*". Unfortunately, taxonomy_menu uses the URL to create the hierarchical menu, so by changing the URL, the hierarchy disappears.
2. Use mod_rewrite to change "taxonomy_menu/*" to "taxonomy/term/*". This works, but the menu collapses after clicking one of the terms. My users (and I) can't live with this behavior.

So it looks like I'm not going to use taxonomy_menu. Instead I'll create menu links by hand.

mdlueck’s picture

I seem to have happened across this bug from the other direction:
"URL attempting to be modified shows tabs, no other changes"
http://drupal.org/node/169298

It appears various things have been tried, without success.

sutharsan’s picture

It requires code to get Taxonomy Menu to work with Views.

mdlueck’s picture

Any suggestions as to finding this required code?

jadwigo’s picture

Status: Active » Needs work
StatusFileSize
new1.49 KB

I tried my coding at this and it seems to work reasonably well with the attached patch

the change is only in the displaying of nodes where the original uses taxonomy_render_nodes and my patch uses theme("view","taxonomy_term"...)
the taxonomy_term view should probably be enabled, and may be customized to your needs...

I only tested it with display descendants turend off, so YMMV

bgoines78’s picture

My disclaimer is that I am new to Drupal (less than a week) so I am still trying to learn the system as well as the code. I immediately began working on the taxonomy_menu/pathauto problem and think I may have a better understanding of the taxonomy_menu/views woes. I think that the problem is that taxonomy_menu registers individual callbacks for the url, 'taxonomy_menu/[vocabulary id]' rather than 'taxonomy_menu'. What this means is that, in order to apply a view to taxonomy_menu, you must specify the vocabulary ID in the URL as well. Long story short, if you create a vocabulary named 'Test Vocabulary' and the ID assigned is 8, the URL of your view should be 'taxonomy_menu/8'. Of course, this limits the view to that specific vocabulary, but that actually works in my favor. Since I currently have a modified version of taxonomy_menu installed in my test environment, I cannot test this theory with a clean installation. Could someone confirm if this works? Tested against Drupal 5.x.

mdlueck’s picture

goines78: You guessed correctly! ;-) Now I know why I was dragging my feet a bit to test out jadwigo's patch!

Adjusted the URL from: taxonomy_menu to: taxonomy_menu/6 and clicking the taxonomy_menu/6 NOW gives a customized view.

So, onward to test out jadwigo's patch.

jadwigo’s picture

the individual taxonomy_menu/[vid] callbacks are there because taxonomy menu lets you choose which vocabularies to show...

my patch does not change any of the menu paths for the taxonomy_menu module - it only changes what happens when you look at a page - now a view is rendered instead of a default taxonomy term page.

mdlueck’s picture

Sounds like you two are saying the same thing, just in different ways.

bgoines78 stated that views will take affect, just that you have to include /[vid] in the URL that views will look for / detect.

It sounds like patch makes it possible to customize the module with views regardless of which /[vid] happens to be being viewed... which is the way the module should work.

bgoines78’s picture

I assume the taxonomy_menu module does not define the path, 'taxonomy_menu', because that would create a throw-away menu item. This would make taxonomy_menu work naturally with views using a url of 'taxonomy_menu'. Like I said before, I'm still new to Drupal so I don't have the whole story yet, but wouldn't this patch now make taxonomy_menu dependent on views? I searched the drupal apis and could not find a replacement theme_view function outside of the views module. I have not tested it, but I'm worried that this would produce a blank page (or page with blank content) if the views module were not installed.

mdlueck’s picture

Like I said before, I'm still new to Drupal so I don't have the whole story yet, but wouldn't this patch now make taxonomy_menu dependent on views? I searched the drupal apis and could not find a replacement theme_view function outside of the views module.

Thanks for pointing that possibility out. Maybe the OP of the patch will comment.

milksamsa’s picture

I am having the same difficulties.
I really want to automate the generation of the menu, but at the same time I would like to customize the nodes listing with a View or a Panel.

Of course it would be great to keep the generation of friendly pathauto [term]/[title] aliases.

I believe this should be a basic Drupal feature as I believe that a hierarchically clear website tree is a common need...
I'm still wondering why such a thing is still so tricky to achieve and is not in core.

Home it gets fixed soon. I am afraid I won't be able to help as I don't really know how to code PHP.

bgoines78’s picture

That is exactly what I am working on and I think I have it mostly working with the exception of feed aliases without views and any type of feed with views. I checked out the view_rss module, and it appears that it arbitrarily guesses what the feed url should be and assumes something like taxonomy_menu/[vid]/*/*/feed which is a path that is not even defined! I do have a version of taxonomy_menu that correctly creates the feed aliases and they work properly without views, but I have been holding it back until I can get the feed working with views. If you want to check out the replacement taxonomy_menu.module, check this post http://drupal.org/node/41476. Note, if you enable the aliases for taxonomy_menu, it is recommended that you disable the path aliases for Categories by removing all patterns. Currently, the taxonomy_menu module creates some aliases that point to the taxonomy/term URLs.

milksamsa’s picture

Thank you bgoines.
I tried applying your version of Taxonomy_menu module.
I found the Taxonomy Menu path settings under admin/settings/pathauto and used [taxonomy_menu_catpath].
I regenerated the aliases, but when I create a matching alias view (eg. apparel/tshirts), the ovveride won't occur.
I still obtain apparel/tshirts without view customization (the basic term listing page). Where am I wrong?

bgoines78’s picture

The views should still be applied to the base taxonomy_menu/[vid] path, not to the alias. I'm not quite sure if the view should actually override an alias or not. I've only tried views in this limited scenario.

milksamsa’s picture

Category: support » feature
Priority: Normal » Critical

Unfortunately, if a view is applied with a page view connected to a url: taxonomy_menu/x/x, the link no longer displays in the menu.
Still looking for a fix. I need to apply a view to taxonomy_menu generated listings... e.

tanoshimi’s picture

Subscribing. I love the functionality of taxonomy_menu, but I'd really like to be able to combine that with the flexibility of views...

danthalian’s picture

subscribing

kingandy’s picture

Subscribing also.

diegohermes’s picture

Subscribing.

s.daniel’s picture

Subscribing

bartoki’s picture

Subscribing. I think the number of people interested in this demonstrates its popularity.

mdlueck’s picture

I guess we have advanced enough that we can get by just fine without Taxonomy Menu or other taxonomy navigation modules.

Our solution is to create URL aliases to taxonomy queries. Then use those URL aliases while creating a menu manually.

Details about the syntax of taxonomy queries can be found here:

"Taxonomy: A way to organize your content"
http://drupal.org/node/299
and scroll down to: "Using categories in menus"

This solution works with stock Drupal, no contrib modules necessary... and GLAD of that detail!!!!

tanoshimi’s picture

I think you've summarised the requirements - menu links which alias taxonomy queries - but surely the whole reason why people want a module like this is that they don't want to have to manually create menu links which mirror a taxonomy which they've already created, but to have them automatically created?

I have a site with over 300 terms in a hierarchical taxonomy - I've already spent time adding and arranging all the categories once when I created the vocabulary, so I don't want to have to do it again in my menu structure - or have I misunderstood your post?

taxonomy_menu actually does this very well, except for the fact it creates it's own url menu structure of /taxonomy_menu/1/3/2 rather than using the default taxonomy/term/2 - which means it can't be overridden with taxonomy_redirect and views etc. which I believe is what this thread is calling for.

t.

mdlueck’s picture

We are making extensive use out of multi-term queries for our menuing system... things that no contrib module could do.

As well, separating site navigation from taxonomy was also a good thing. You could click on "Platform" first, then "Linux". But others might click on a category of application, then "Linux" to refine that application category to only the Linux apps. Utilizing / leveraging Taxonomy queries lets us have a single "Linux" tag used in countless queries, thus countless menu choices dealing with "Linux" in some way, shape, or form. Taxonomy Menu and all other contrib modules totally ignore the power of multi-term Taxonomy queries.

So, we came full circle... Doing more powerful things and no need for a contrib module.

jadwigo’s picture

Priority: Critical » Normal

has anyone actually tried the patch I posted earlier?

I use it to make the taxonomy_menu structure redirect to a view.. and it does work AFAIK

(BTW a critical feature for a contrib module? reassigned the priority)

ferrangil’s picture

As said in #28, I also have a large taxonomy and this what I need.
I have redirected each term to its corresponen node, using taxonomy_redirect, so I also want to redirect to each node when I click on the menu.
I applied your patch, jadwigo, but I can't detect any different funcionality or whatever... Any hints?

jadwigo’s picture

@ferrangil - there is no difference, because with my patch the taxonomy_menu page is redirected to the normal taxonomy/term view that you can change.
Using taxonomy_redirect would override that again, and then it won't work again.

summit’s picture

Subscribing. Noticed there is a taxonomy menu plus now?
http://drupal.org/project/tmp may be integration necessary?

greetings,
Martijn

Spames’s picture

This seems to work perfectly for me! -- I can specify the view to use to display the content. Just what I needed! - Thanks

ferrangil’s picture

@ jadwigo - Still trying with your patch, without success. I need to leave the taxonomy_redirect active because when I click the breadcrumb, I want to go to the associated node of that term, instead of going to the term page (which will display the link to the node, so I avoid that stupid click and I go direct to the "content").

With your patch applied, I'm still seeing the link in my menu like ../taxonomy_menu/2/212 or whatever... From your words I understand I should see something like .../taxonomy/120 (where 120 is one term id...).
I opened the taxonomy_menu.module and your changes are in it, so I applied the patch correctly.

What I'm missing? My menu is always pointing to taxonomy_menu....

Thanks!

jadwigo’s picture

@ferrangil: you could try to modify my code to output

    // instead of the normal rendering of nodes get the default taxonomy_term view here
    /** 
     * insert code to load the node that taxonomy redirect points to
     **/ 
    return theme('node', $node);

instead of

    // instead of the normal rendering of nodes get the default taxonomy_term view here
    return theme('view', 'taxonomy_term', null, null, 'embed', $tids);

Please note that is not a ready solution and a some programming is required to make it work

ferrangil’s picture

No changes.
I'll look at the code to see if I could change something else. I'm still viewing all links as ../taxonomy_menu/.... so my system doesn't use your function..

Odd!

More suggestions?
Thx

brmassa’s picture

Status: Needs work » Fixed

Guys,

im a new maintainer and i just launched the new version of the module. it now has this feature.

regards,

massa

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

Raveler’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Priority: Normal » Critical
Status: Closed (fixed) » Active

Hello guys,

It seems that none of the proposed solutions work with the newest version of Drupal.

To get Taxonomy Menu working at all, you first need to apply the patch mentioned in:
http://drupal.org/node/263766
Also, make sure you use the dev version.

Then, to get views working, I found an easy fix, based on the previously posted solutions (which don't work anymore).

To get it to work, you just need to change the lines 268-270 in taxonomy_menu.inc:

        // Get the nodes
        $result = taxonomy_select_nodes(array($tid), 'or',
          variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);

.. to the following line:

return views_embed_view("name_of_view", "page", $tid);

This will add the term id as the first argument. Make sure the name of the view is the actual name used by views to identify the view, not the title or the path or anything. If this doesn't work, let me know, I'll look into it. It worked for me though.

vvvi’s picture

Drupal 6.4 It doesn't work still.

Replasing

        // Get the nodes
        $result = taxonomy_select_nodes(array($tid), 'or',
          variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);

.. to

return views_embed_view("name_of_view", "page", $tid);

not help.

Any ideas, please.

Regards,
Viktor

vvvi’s picture

StatusFileSize
new10.86 KB

I have done some changes and now it works good. The worked file taxonomy_menu.inc for 6.x-1.x-dev is attached (rename taxonomy_menu.inc_.txt to taxonomy_menu.inc).

In views add arguments:
Taxonomy: Vocabulary ID
Taxonomy: Term ID

Was done next changes:

Firstly applyed patch http://drupal.org/node/263766

Function

function _taxonomy_menu_admin(&$form_state) {
  $options = array(
    TAXONOMY_MENU_NONE    => t('No'),
    TAXONOMY_MENU_NORMAL  => t('Normal')
  );

  // If the Views module is enabled, add some special
  // new features
//   if (module_exists('views')) {
//     // Add the Views file with more functions
//     require_once(drupal_get_path('module', 'views') .'/views_cache.inc');
//
//     // Add a new options on Categories
//     $options[TAXONOMY_MENU_VIEW] = t('Views');
//
//     // Get the list of User generated views
//     $views = db_query("SELECT * FROM {view_view}");
//     while ($view = db_fetch_array($views)) {
//       $views_list[$view['name']] = $view['page_title'];
//     }
//
//     // Now get a list of default Views
//     foreach (_views_get_default_views() as $view => $viewdata) {
//       $views_list[$view] = $viewdata->name;
//     }
//   }

  // If the Taxonomy Default module is enabled, add some special
  // new features
  if (module_exists('taxonomy_defaults')) {
    $options[TAXONOMY_MENU_DEFAULT_TAX] = t('Module types');
  }

  // Create some options for each of the vocabularies
  foreach (taxonomy_get_vocabularies() as $vocab) {
    $form[$vocab->vid] = array(
      '#title'          => $vocab->name,
      '#tree'           => FALSE,
      '#type'           => 'fieldset'
    );
    $form[$vocab->vid]['taxonomy_menu_show_'. $vocab->vid] = array(
      '#default_value'  => variable_get('taxonomy_menu_show_'. $vocab->vid, TAXONOMY_MENU_NONE),
      '#options'        => $options,
      '#title'          => t('Show this category in menu'),
      '#type'           => 'radios'
    );

    // In case of View options selected, select Views
//     if (module_exists('views')) {
//       $form[$vocab->vid]['taxonomy_menu_show_view_'. $vocab->vid] = array(
//         '#default_value'  => variable_get('taxonomy_menu_show_view_'. $vocab->vid, ''),
//         '#options'        => $views_list,
//         '#title'          => t('Views available'),
//         '#type'           => 'select'
//       );
//     }
  }

  // General options
  $form['taxonomy_menu_display_page'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_page', 'category'),
    '#description'    => t('How should be the first item on the menu? Example: categories/1/2/3, technology/1/2/3'),
    '#title'          => t('Module page'),
    '#type'           => 'textfield',
  );
  $form['taxonomy_menu_display_num'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_num', FALSE),
    '#description'    => t('If checked, number of node per term will be displayed in the menu.'),
    '#title'          => t('Display number of nodes per terms'),
    '#type'           => 'checkbox',
  );
  $form['taxonomy_menu_hide_empty'] = array(
    '#default_value'  => variable_get('taxonomy_menu_hide_empty', FALSE),
    '#description'    => t('If checked, only taxonomy terms with members will be shown in the menu.'),
    '#title'          => t('Hide Empty Terms'),
    '#type'           => 'checkbox',
  );
  $form['taxonomy_menu_display_descendants'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_descendants', TRUE),
    '#description'    => t('If checked, then when a term is selected all nodes belonging to subterms are also displayed.'),
    '#title'          => t('Display descendants'),
    '#type'           => 'checkbox',
  );

  $form['submit'] = array(
    '#type'           => 'submit',
    '#value'          => t('Save configuration')
  );

  return $form;
}

was changed to (not only uncommented)

function _taxonomy_menu_admin(&$form_state) {
  $options = array(
    TAXONOMY_MENU_NONE    => t('No'),
    TAXONOMY_MENU_NORMAL  => t('Normal')
  );

  // If the Views module is enabled, add some special
  // new features
   if (module_exists('views')) {
     // Add the Views file with more functions
     require_once(drupal_get_path('module', 'views') .'/includes/cache.inc');

     // Add a new options on Categories
     $options[TAXONOMY_MENU_VIEW] = t('Views');

     // Get the list of User generated views
     $views = db_query("SELECT * FROM {views_view} a LEFT JOIN {views_display} b ON a.vid=b.vid");
     while ($view = db_fetch_array($views)) {
        $views_list[$view['name'].':'.$view['id']] = $view['name'].' : '.$view['id'];
     }
     
   }

  // If the Taxonomy Default module is enabled, add some special
  // new features
  if (module_exists('taxonomy_defaults')) {
    $options[TAXONOMY_MENU_DEFAULT_TAX] = t('Module types');
  }

  // Create some options for each of the vocabularies
  foreach (taxonomy_get_vocabularies() as $vocab) {
    $form[$vocab->vid] = array(
      '#title'          => $vocab->name,
      '#tree'           => FALSE,
      '#type'           => 'fieldset'
    );
    $form[$vocab->vid]['taxonomy_menu_show_'. $vocab->vid] = array(
      '#default_value'  => variable_get('taxonomy_menu_show_'. $vocab->vid, TAXONOMY_MENU_NONE),
      '#options'        => $options,
      '#title'          => t('Show this category in menu'),
      '#type'           => 'radios'
    );

    // In case of View options selected, select Views
     if (module_exists('views')) {
       $form[$vocab->vid]['taxonomy_menu_show_view_'. $vocab->vid] = array(
         '#default_value'  => variable_get('taxonomy_menu_show_view_'. $vocab->vid, ''),
         '#options'        => $views_list,
         '#title'          => t('Views available'),
         '#type'           => 'select'
       );
     }
  }

  // General options
  $form['taxonomy_menu_display_page'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_page', 'category'),
    '#description'    => t('How should be the first item on the menu? Example: categories/1/2/3, technology/1/2/3'),
    '#title'          => t('Module page'),
    '#type'           => 'textfield',
  );
  $form['taxonomy_menu_display_num'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_num', FALSE),
    '#description'    => t('If checked, number of node per term will be displayed in the menu.'),
    '#title'          => t('Display number of nodes per terms'),
    '#type'           => 'checkbox',
  );
  $form['taxonomy_menu_hide_empty'] = array(
    '#default_value'  => variable_get('taxonomy_menu_hide_empty', FALSE),
    '#description'    => t('If checked, only taxonomy terms with members will be shown in the menu.'),
    '#title'          => t('Hide Empty Terms'),
    '#type'           => 'checkbox',
  );
  $form['taxonomy_menu_display_descendants'] = array(
    '#default_value'  => variable_get('taxonomy_menu_display_descendants', TRUE),
    '#description'    => t('If checked, then when a term is selected all nodes belonging to subterms are also displayed.'),
    '#title'          => t('Display descendants'),
    '#type'           => 'checkbox',
  );

  $form['submit'] = array(
    '#type'           => 'submit',
    '#value'          => t('Save configuration')
  );

  return $form;
}

Also function

function _taxonomy_menu_page() {
  // Check if the Vocabulary ID is set
  if ($vid = arg(1)) {

    // Depending on what Output technique is used,
    // show the nodes' list
    if (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_NORMAL) {
      if ($tid = arg(2)) {
        $tid = explode('/', $_GET['q']);
        $tid = db_escape_string(array_pop($tid));

        // Add the RSS feed
        $feed = url('taxonomy/term/'. $tid .'/'.
          (variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0) .
          '/feed');
        drupal_add_feed($feed);

        // Get the nodes
        $result = taxonomy_select_nodes(array($tid), 'or',
          variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);
      }
      else {
        // If no arg(2), we're looking at just the vid. If
        // display_descendants is on, grab all terms regardless
        // of depth. If off, grab depth 0 terms.
        $tree = taxonomy_get_tree($vid);
        $descendants = variable_get('taxonomy_menu_display_descendants', 1);
        foreach ($tree as $term) {
          if ($descendants or $term->depth == 0) {
            $tids[] = $term->tid;
          }
        }

        // The requested terms have already been determined,
        // so don't request descendants here.
        $result = taxonomy_select_nodes($tids, 'or', 0);
      }

      // Render the selected nodes
      $output = taxonomy_render_nodes($result);
    }
    elseif (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_VIEW) {
      // Get the last page argument
      $tid = explode('/', $_GET['q']);
      $tid = db_escape_string(array_pop($tid));

      $arguments[] = $vid;

      // Only add the Term ID if its not the Vocabulary ID
      if ($vid != $tid) {
        $arguments[] = $tid;
      }

      // Embed the views output into the page
      $output = views_build_view('embed',
        views_get_view(variable_get('taxonomy_menu_show_views_'. $vid, '')),
        $arguments, FALSE, NULL);
    }
    elseif (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_DEFAULT_TAX) {

    }
  }

  // If no content found, return a "error" message
  return empty($output) ? t('No content for this category.') : $output;
}

was changed to

function _taxonomy_menu_page() {
  // Check if the Vocabulary ID is set
  if ($vid = arg(1)) {

    // Depending on what Output technique is used,
    // show the nodes' list
    if (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_NORMAL) {
      if ($tid = arg(2)) {
        $tid = explode('/', $_GET['q']);
        $tid = db_escape_string(array_pop($tid));

        // Add the RSS feed
        $feed = url('taxonomy/term/'. $tid .'/'.
          (variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0) .
          '/feed');
        drupal_add_feed($feed);

        // Get the nodes
        $result = taxonomy_select_nodes(array($tid), 'or',
          variable_get('taxonomy_menu_display_descendants', 1) ? 'all' : 0);
      }
      else {
        // If no arg(2), we're looking at just the vid. If
        // display_descendants is on, grab all terms regardless
        // of depth. If off, grab depth 0 terms.
        $tree = taxonomy_get_tree($vid);
        $descendants = variable_get('taxonomy_menu_display_descendants', 1);
        foreach ($tree as $term) {
          if ($descendants or $term->depth == 0) {
            $tids[] = $term->tid;
          }
        }

        // The requested terms have already been determined,
        // so don't request descendants here.
        $result = taxonomy_select_nodes($tids, 'or', 0);
      }

      // Render the selected nodes
      $output = taxonomy_render_nodes($result);
    }
    elseif (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_VIEW) {
      // Get the last page argument
      $tid = explode('/', $_GET['q']);
      $tid = db_escape_string(array_pop($tid));


      list($wview, $wpage) = explode(':', variable_get('taxonomy_menu_show_view_'. $vid, ''));
      
      // Only add the Term ID if its not the Vocabulary ID
      if ($vid == $tid) {
        $output = views_embed_view($wview,$wpage,$vid);
      }
      else {
		$output = views_embed_view($wview,$wpage,$vid,$tid);
  	  }
    
    }
    elseif (variable_get('taxonomy_menu_show_'. $vid, TAXONOMY_MENU_NONE) == TAXONOMY_MENU_DEFAULT_TAX) {

    }
  }

  // If no content found, return a "error" message
  return empty($output) ? t('No content for this category.') : $output;
}

Hope it help.

My best regards,
Viktor

summit’s picture

Version: 6.x-1.x-dev » 5.x-1.x-dev

Hi,

Could this patch also work to get the possibility to use different names for different taxonomy/term depth levels?
I need for every depth level the possibility to get a new url_argument instead of category or taxonomy/term to trigger a different template.
Thanks in advance for your answer!

Greetings,
Martijn

derhasi’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Component: User interface » Code
StatusFileSize
new6.56 KB

I improved the code of VVVi and applied it to the current dev. So now views_page() is used. This overrides the tm-page view with the views-view. So you now can set title and breadcrumb with the view's settings.

Attached a .patch on current 6-dev.

Tagged post to Version 6-dev and component: code.

derhasi’s picture

Status: Active » Needs review

It also fixes argument problems, when no $tid is present. ($vid != $tid) does not work because e.g. voc #1 can have a term-id #1.

Afief’s picture

Okay guys I realize that Views integration is one of the most important things for a Drupal Module, especially a module like Taxonomy Menu.

I'd like to finish some refining of the Menu code before working on Views integration because the way Menus are handled right now creates a serious bottleneck for what can be done(moving Menu items around and still being able to get the right breadcrumb for example.)

Keep polishing that patch because I haven't read the Views API yet and will probably be too lazy to do proper research :-P

summit’s picture

Hi,
Please do not forget Drupal 5 people here
Thanks for considering!
greetings,
Martijn

Afief’s picture

Hey Summit,

Unfortunately I am very inexperienced with Drupal5. Although I read the Drupal Pro Development book(based on Drupal 5) I've never actually written any D5 code and only ever built 3 Drupal5 sites.

I know this is a bad thing in a maintainer, but my first priority will be the D6 version, god knows there are only a few months left before Drupal 7 is scheduled for release.

Of course I'd like leaving the D5 version in an at least working(tm) state(I don't know, is it working? the issue queue suggests it isn't) but I simply don't see there being enough time between fixing the D6 version, my dayjob and the D7 release.

hutch’s picture

I for one also want to get D5 sorted and I will be keeping a close eye on the development of D6 with the aim of backporting code as Fief tidies things up in D6.

scottrigby’s picture

Hi derhasi,
The patch in #44 has some failed hunks against the current dev - but I looked in the .rej file and seems this is already in the .inc file - does this mean these changes were already included in the committed to the current dev version?

here's what my command line said:

$ patch < tm.patch
(Stripping trailing CRs from patch.)
patching file taxonomy_menu.inc
Hunk #1 FAILED at 1.
Hunk #6 FAILED at 228.
2 out of 7 hunks FAILED -- saving rejects to file taxonomy_menu.inc.rej

BTW, the project page says it does already integrate with Views?

Thx for any clarification - since the main reason I want to use this module is for it's Views integration.

Cheers :)
Scott

Afief’s picture

the Drupal5 version apparently used to work with Views(not sure if it currently does)
the Drupal6 version definitely does not work with views yet.

soliaris’s picture

Hello,

#42 and #44 works fine with first level of taxonomy hierarchy -> category/vid/tid.

I am using multiple levels of taxonomy hierarchy and would like to have view with arguments. In view configuration I am adding view path like category/%, so for cat/vid/tid - is ok, first argument is vid, second is tid. How about vid/tid/tid - shall I use 3 arguments and argument #3 is actual, for vid/tid/tid/tid - 4 arguments and argument #4 is actual? Is my understanding correct? Secondly - how view will know which argument to use - #2, #3 or #4 if path one time can be vid/tid, another vid/tid/tid or vid/tid/tid/tid...

Best regards,
Soliaris

kingandy’s picture

From my modest experience with taxonomy_menu and views, I seem to recall the VID and the last TID get passed through as arguments - so all you need to do is create a single view with 'Taxonomy: Vocabulary ID' and 'Taxonomy: Term ID' as arguments. The vid/tid/tid/tid notation is purely to establish the menu structure.

Don't specify the arguments in the view's path (eg. category/$arg/$arg) - just give it a path of 'category' and let the arguments sort themselves out.

scottrigby’s picture

Afief, what do you think of this solution? http://drupal.org/node/315488#comment-1046168
I'd like to invest energy in a direction that is likely to be maintained - or at least is a viable direction.
Cheers :)
Scott

derhasi’s picture

Afief and me are working on a total rewrite of the module in the moment. So integration of other modules would be much easier.

summit’s picture

Hi, Derhasi, your remark about the total rewrite asks me the following.
Please keep the category/VID/TID/TID etc.. as one of the options. A site of mine depends on this logic. Thanks in advance for considering this. Just a remark, not intended to hijack this thread.
Greetings, Martijn

derhasi’s picture

We will implement a hook, that lets other modules build their own "path generators", so we will become flexible for a lot more tasks;)

karens’s picture

Status: Needs review » Closed (duplicate)

There's a working patch at #333145: Views integration for Views integration, so I think this is a duplicate, even though it is older. Apologies if I'm closing this inappropriately.