I am trying to work with a view so that it can take arguments from multiple categories, the problem I am running into here is that the vid that is added into the url keeps me from having the view draw multiple terms from more than one vocabulary. Is there a way to either make the view ignore arg 1 or is there a way to make the taxonomy menu stop adding the vid into the url?
Any hints are appreciated.

Comments

lemonis’s picture

I have a similar problem. But I think its not only the vid.
I can access every term in two ways:
taxonomy/term/31
taxonomy/vocabulary/4/70

4 ist the vid
31 and 70 is the same term

The taxonomy menu is using the later url with the vid.
And pathauto generates an alias for the first.

Is there a way to adapt taxonomy menu to use the first way?

murz’s picture

Patch for DRUPAL-5 CVS: remove link to main module page in paths.
This patch add an option in module settings to remove main page link from menu and adds all vocabularies to menu root.
Path from:
category/1/2/3
category/5/8

converts to:
1/2/3
5/8

murz’s picture

Title: How to remove vid from url » Patch for remove vid or module page from url (with pathauto support)
Version: 5.x-1.02 » 5.x-1.03
Status: Active » Needs review
StatusFileSize
new6.48 KB

Added support pathauto module for building SEF aliases.
Now you can convert path from
category/1/2/3
to

category/fruit/apples/red
fruit/apples/red

and more other variants with pathauto and token templates.

giggler’s picture

Cool - what setting do you need to change to have the following. I ran the patch and the menu is still category/1/2/. Is it changing pathauto to [catalias]?:

category/1/2/3
to
category/fruit/apples/red

giggler’s picture

Nevermind...it was [catpath-raw] ! Thank you so much, now it works perfectly!

lemonis’s picture

Hm, the patch isn't working for me. The "Hide link to module page" checkbox was added but if I select and save it, its unchecked again (after saving/reload).

I have 5.7 not the CVS Version.

Did I miss a step?
-> patch module
-> update.php
-> activate "Hide link to module page" checkbox

murz’s picture

I test this patch in my Drupal 5.7 and "Hide link to module page" checkbox stored successfully. I have edited some places in my patch, try the new version.

murz’s picture

Title: Patch for remove vid or module page from url (with pathauto support) » Patch for pathauto support and option to remove module page from url

New patch version with solved issue when using Page Title version 5.x-2.0-alpha5.

murz’s picture

Version: 5.x-1.03 » 5.x-1.x-dev
Category: support » feature
tf5_bassist’s picture

Maybe it's just me, but I'm not finding anywhere how to apply patches without having ssh access. Is there another way to apply this patch?

hutch’s picture

You can apply patches on a Linux or a Mac box, or at a pinch use a Linux LiveCD such as Knoppix. I don't know wether the patch program is available for Windows but Cygwin might do it.

murz’s picture

You can download module files to local folder on your computer, apply patch (with the software or with hands), and after that upload pached version of module to site via FTP or any other method.

ckng’s picture

Confirm patch works as stated.
Thanks for the patch =)

nbchip’s picture

For applaying patches i use Zend for Eclipse...
Patch works but unlike pathauto u can only make one path for all vocabularies...
Now if only i could somehow make Taxonomy Breadcrumb to work with Categories or maybe Custom Breadcrumbs (but they unfortunetly dont have settings for vocabularies)...
but ill see what will happen when i put custom tpl pages with views behind categories links...

suit4’s picture

Just tried taxonomy_menu_hide_modulepage_w_pathauto_4.patch and id did not work for me as expected.

vocabs and terms are replaced nicely and correctly, but links from the seconf menu level do not show up in the selected view.

I use taxonomies with 2 levels or deeper.

parent - shows up in correct view
- Child - shows up in stadard node view.

Proof me wrong, but there are two lines in the patch which seem to be wrong:

Line 76 should read: + if ($vid=variable_get('taxonomy_menu_hide_module_page', FALSE)?arg(0):arg(1)) {
Line 82 sould read: if ($tid=variable_get('taxonomy_menu_hide_module_page', FALSE)?arg(1):arg(2)) {
(Modified patch attached)

Otherwise, in both cases, the original condition might result in FALSE.
if (($vid = arg(0)) || ($vid=variable_get('taxonomy_menu_hide_module_page', FALSE)?arg(0):FALSE)) {

Second:
If 'Hide link to module page' is set to true, the pathauto setting for Taxonomy menu path settings must not be
categories/[vocab-raw]/[cat-raw]
but
[vocab-raw]/[cat-raw]
otherwise, the 'module page' is somehow back.

This is not very obvious in this whole patching thing.

Code suggestion, which awfully isn't really dynamic but an approach:
set the $settings['patterndefault'] according to the 'Hide link to modul page' selection state.

function taxonomy_menu_pathauto($op){
  switch ($op){
    case 'settings':
      $settings = array();
      $settings['module'] = 'taxonomy_menu';
      $settings['token_type'] = 'taxonomy';
      $settings['groupheader'] = t('Taxonomy menu path settings');
      $settings['patterndescr'] = t('Pattern for taxonomy menu pages');
      $settings['patterndefault'] = (variable_get('taxonomy_menu_hide_module_page', FALSE))? t('[vocab-raw]/[cat-raw]') : t('categories/[vocab-raw]/[cat-raw]');
      $patterns = token_get_list('taxonomy');
      foreach ($patterns as $type => $pattern_set) {
        if ($type != 'global') {
          foreach ($pattern_set as $pattern => $description) {
            $settings['placeholders']['['. $pattern .']'] = $description;
          }
        }
      }
    return (object) $settings;
  }
}

(NOT included in the patch, just wanted to discuss that first)

CoPut’s picture

Title: Patch for pathauto support and option to remove module page from url » This patch does not care about node breadcrumbs
StatusFileSize
new8.12 KB

This patch doesn't applies any changes to nodes location generation function. So taxonomy menu doesn't generates right breadcrumbs. Those breadcrumbs contains no vocab item and items paths ignores paths generation rules of original patch.

To solve this I've changed _taxonomy_menu_node_view(&$node, &$vocabs) function. Here new function and helper function I added to siplify my code:

/**
 * Generates the breadcumb for nodes that
 * have a category listed as a menu
 *
 * @param
 *   Object. The node object
 * @param
 *   Array. The list of all taxonomy vocabs and
 *   terms that this node have and are also
 *   menus
 */
function _taxonomy_menu_node_view(&$node, &$vocabs) {
  foreach ($vocabs as $vid => $vocab) {

    if(variable_get('taxonomy_menu_hide_module_page', FALSE)) $path = $vid;
    else $path =  variable_get('taxonomy_menu_display_page', 'category') .'/'. $vid;

    $breadcrumb_items = array('path' => $path, 'title' => t(taxonomy_get_vocabulary($vid)->name)) +
                        _taxonomy_menu_get_term_breadcrumb_items($vocab[0], $path) +
                        array('path' => 'node/'. $node->nid, 'title' => $node->title);

    menu_set_location($breadcrumb_items);
    return;
  }
}

/**
 * Generates location items for specifyed term and parent terms
 *
 * @param
 *   Number. Term identificator.
 * @param
 *   Array. Base path for term (vocabulary path).
 */
function _taxonomy_menu_get_term_breadcrumb_items($tid, $path) {
  $tree = taxonomy_get_tree(taxonomy_get_term($tid)->vid);

  foreach ($tree as $term_node) {
    if ($term_node->tid == $tid) {

      $parent_items=array();

      if ($term_node->parents[0]!=0) {
        $parent_items = _taxonomy_menu_get_term_breadcrumb_items($term_node->parents[0], $path);
        $parent = end($parent_items);
        $path = $parent['path'];
      }

      array_push($parent_items, array('path' => $path.'/'.$term_node->tid, 'title' => t($term_node->name)));

      return $parent_items;
    }
  }
}
summit’s picture

Hi,
Will this patch be committed please? Pathauto - Taxonomy menu is a great combination!
greetings,
Martijn

pelicani’s picture

Looking at code, quickly, and don't see anywhere the category title (term->name) is used in the URL.
I thought it was trying to removed the 'module' and change the vocab and term into a abc string.
If y'all have moment to explain what I'm missing, I'd be appreciative.
We have hacked the module and were going to contribute, but this thread seems to cover some of the same function.
Just want to get a clear if I need a new thread or if this will do.

summarize: sync path auto with tax_menu so they use the same link.

jenlampton’s picture

I have an existing site, with aliases already created for all my term pages. Example: taxonomy/term/5 is aliased to 'regions'

After installing this module, all the links to these pre-existing pages are in the form: category/1/5 and do not reflect any of the existing aliases.

This site has a lot of value in it's SEO and replacing the links in my main navigation with something new is not an option. Is there any way we can make this module smart enough to use what's already there, rather than trying to do it's own thing? Can't it use the url function, or drupal_get_path_alias to build the links? Hard coding seems silly.

Thanks,
Jen

asak’s picture

Can anyone confirm the latest patch works smoothly?

indytechcook’s picture

Title: This patch does not care about node breadcrumbs » Path Auto Support

There seems to be a duplicate effort. #192493: Using path aliases with menu paths I need confirmation that this patch works correctly. Then I can create a release for one of the two patches.

indytechcook’s picture

Status: Needs review » Reviewed & tested by the community

I will commit this in a D5 Dev version this Friday if no one from #192493: Using path aliases with menu paths is object to it. I suspect they won't be considering this adds the hide vocabulary feature.

summit’s picture

Hi,

I use the functionality like taxonomy_menu/vid/tax_id_level1/tax_id_level2/tax_id_level3 fully. I would very much still like to do this.

It's a great way to have a hierarchical solution depending on the depth of the term. Like explained in http://drupal.org/node/192493#comment-633741

In my situation:
If there is a tax_id on level 3, then the url should be view_3
If there is a tax_id on level 2, then the url should be view_2
If there is a tax_id on level 1, then the url should be view_1.
I have used this on my website www.wintersport-accommodaties.nl (dutch).

Hopefully this is still possible after this change :)
Greetings,
Martijn

indytechcook’s picture

Summit, please try the patch out and let me know. I don't have ANY D5 experience and am relying on the community to support this version. That being said, I took a look at the patch, and it looks like you have to turn on the functionality.

Can someone please answer summit's concern.

indytechcook’s picture

Status: Reviewed & tested by the community » Fixed

This is part of the latest DEV. Please test. I implemented this in conjunction with #192493: Using path aliases with menu paths.

sansui’s picture

Hi indy,

I'm using the latest version, changed my paths in path auto and generated the new aliases for my taxonomy menus....

Seems to work when I'm displaying a taxonomy in a block with my panels, but when I have the menu provided from the module in my primary links, it still shows up as category/* etc

lakyljuk’s picture

Status: Fixed » Active

Same problem here.

JacobSingh’s picture

I have the same issue... It seems the code is actually commented out in the .inc file

-Jacob

indytechcook’s picture

Status: Active » Postponed (maintainer needs more info)

I'll be happy to update the code.

Jacob, Where in the code is it commented out? I will uncomment and commit. Or you can submit a patch.

Thanks,
Neil

TomChiverton’s picture

here's a patch, as suggested, but my menu block hasn't change. Maybe some cache has to time out or be invalidated somewhere ?

--- taxonomy_menu.inc.orig      2009-03-24 19:55:05.000000000 +0000                    
+++ taxonomy_menu.inc   2009-03-24 19:55:27.000000000 +0000                            
@@ -118,12 +118,10 @@
  * Its the main function for this module.
  */
 function _taxonomy_menu_menu() {
-  /**
   if (module_exists('pathauto')) {
     $pathauto_exists=true;
     _pathauto_include();
   }
-  **/

   $items['admin/settings/taxonomy_menu'] = array(
     'access'              => user_access('administer site configuration'),
@@ -160,23 +158,19 @@
         'weight'          => $vocabulary->weight
       );

-      /**
       if($pathauto_exists) {
         $placeholders = pathauto_get_placeholders('taxonomy', $vocabulary);
         $alias = pathauto_create_alias('taxonomy_menu', 'update', $placeholders, $path,$vocabulary->vid);
       }
-      **/

       $tree = taxonomy_get_tree($vocabulary->vid);
       $old_depth = -1;
       $old_path = $path;

-      /**
       if($pathauto_exists) {
         $placeholders = pathauto_get_placeholders('taxonomy', $term);
         $alias = pathauto_create_alias('taxonomy_menu', 'update', $placeholders, $path,$term->tid);
       }
-      **/

       foreach ($tree as $term) {
         if ($term->depth <= $old_depth) {

indytechcook’s picture

Status: Postponed (maintainer needs more info) » Needs review

Thanks, Tom. I commited these changes. The DEV should be created tomorrow. Please let me know and I'll add to stabe.

summit’s picture

Hi,
Will this also work for D6 please, or is this already tackled for D6?
Greetings,
Martijn

TomChiverton’s picture

Status: Needs review » Postponed (maintainer needs more info)

I've tried toggling the cache on and off in admin, performance and it's not made the menu change.
I'm also a little surprised that the $alias variable that my patch now allows to be set, seemingly from calling pathauto, isn't actually used anywhere.
But I'm not sure how it's meant to work, so don't know if that's the real fault ?

arlinsandbulte’s picture

Status: Postponed (maintainer needs more info) » Fixed

This issue is very old and has been at "postponed (maintainer needs more info)" for a very long time.
I am going to close it out by marking as fixed.
If someone thinks this is still valid, go ahead and re-open.

Status: Fixed » Closed (fixed)

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