Using path aliases with menu paths

doudou - November 15, 2007 - 16:10
Project:Taxonomy Menu
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs review)
Description

I couldn't find a similar issue previously posted. Basically I use Taxonomy Menu to update all of my menu structures. However pathauto would not rename the menu paths. For example a menu path may look like this: /taxonomy_menu/3 instead of something meaningful like /blog/drupal.

#1

greggles - November 15, 2007 - 17:05
Project:Pathauto» Taxonomy Menu
Version:5.x-1.2» 5.x-1.x-dev

This is something that the taxonomy menu module would have to implement. For example code see how this is done for the blog module in pathauto_user.inc

You just need to implement two hooks.

#2

levavie - November 19, 2007 - 09:02
Status:active» patch (code needs review)

As a temporary solution, I've written a module which uses custom_url_rewrite to change all taxonomy_menu URLs to the correct taxonomy/term/... form, and works with pathauto URLs.

This works great on the top nice_menus on my site, http://levavie.com

rewrite.module may be downloaded from here: http://drupal.org.il/sites/drupal.org.il/files/rewrite.tar.gz

Here is the code, adapted from the multidomain module:

<?php

if (!function_exists('custom_url_rewrite')) {

  function custom_url_rewrite($type, $alias, $real_path) {

    $path = ( $alias ) ? $alias : $real_path;
    $parts = explode('/', $path);
    if ($parts[0] == 'taxonomy_menu') {
      $path = 'taxonomy/term/'. end($parts);

      $result = db_query( "SELECT dst FROM {url_alias} WHERE src= '%s'", $path);
      while ($row = db_fetch_object($result)) {
        $path = $row->dst;
        break;
      }

    }
    return $path;
  }     
}        
else {  
   drupal_set_message('error', t('The rewrite module has found a custom_url_rewrite function that is already defined. This conflicts with the module\'s operations, and as such the rewrite module will not work'));
}           

Enjoy,

Amnon
-
Professional: Drupal Israel | Drupal Development & Consulting | Effective Hosting Strategies | בניית אתרים
Personal: Hitech Dolphin: Regain Simple Joy :)

#3

levavie - November 19, 2007 - 09:10
Status:patch (code needs review)» patch (code needs work)

#4

giggler - February 17, 2008 - 02:35

How is this used after installing the module?

#5

Murz - March 24, 2008 - 15:04

I add some support for pathauto module in my patch Patch for remove vid or module page from url (with pathauto support), you can try to use it.

#6

Jeroen Coumans - April 16, 2008 - 23:00

This works great, but its behaviour is slightly different from taxonomy menu: for terms with subterms, the children aren't displayed anymore.

#7

Murz - April 17, 2008 - 10:48

This is work on my drupal 5.2 versions with subterms good. You can look at it on my development site http://gr.shtrix.ru/articles/kimberly-clark/ripple
If you use menu block split module, it have an issue that can be solved width this patch.

#8

fallsemo - June 18, 2008 - 14:29

subscribe.

#9

q0rban - August 11, 2008 - 20:06

Sorry everyone, I don't know why I didn't see this before posting another request and patch for this feature. You can download the patch here.

#10

pelicani - September 8, 2008 - 16:19
Status:patch (code needs work)» patch (code needs review)

The link above is to a duplicate issue.
A duplicate of this issue.
So if you follow the logic, as I did, you get in an infinite loop.

We are looking for taxonomy_menu to honor the pathauto settings.
I believe this patch should do this.
I have yet to test, but here it is.
*Taken from dupe issue listed as #9 above*

AttachmentSize
taxonomy_menu_pathauto_0.patch.txt5.66 KB

#11

q0rban - September 8, 2008 - 16:36

Man, how did you break out of that loop!

;)

Sorry, I guess my link was a bit misleading as it linked to the issue that had the file attached, and not the actual file itself.
Here's the correct link.

#12

Summit - September 12, 2008 - 16:47

Subscribing, looking for an option to use depth to change the url build like taxonomy/term..
greetings,
Martijn

#13

alliax - November 4, 2008 - 08:44

What a bad surprise to realize that taxonomy menu module is creating duplicate content on my site because I already use pathauto and this module doesn't care about aliases and uses it's own path. So I end up with two urls in google for the same page, how bad... What were the developpers thinking when they choose not to support pathauto? Incredible!
Please someone correct this, the issue has been going on for over a year, it looks like someone doesn't want this BUG to be fixed!

#14

greggles - November 4, 2008 - 13:10
Title:Using pathauto with menu paths» Using path aliases with menu paths

It's not really a matter of "not supporting pathauto" it's a matter of not supporting path aliases in general (since pathauto is just a wrapper around the core path system).

But yes, I agree...bump?

#15

Summit - November 4, 2008 - 14:29

Hi,

Not wanting to hijack this thread, but asking for considering keeping also the present functionality
The great thing from taxonomy_menu is the fact that the hierarchy of the terms is showed in the url.
I build a very small function on this to be able to use different panels at different term level.

See www.wintersport-accommodaties.nl for a example of my use of the taxonomy_menu module.
http://www.wintersport-accommodaties.nl/land-info/Frankrijk
land-infoIs the taxonomy_menu /VID/TID panel
http://www.wintersport-accommodaties.nl/gebied-info/Espace-Killy
gebied-info is the taxonomy_menu /VID/TID/TID panel

Hopefully a solution can come up to use path aliases, but still be able to use the /VID/TID/TID etc.. functionality from taxonomy_menu which I now use.

Greetings, Martijn

#16

asak - November 19, 2008 - 20:21

So... does any of this work?

EDIT: WORKS!

Thanks for this patch... it's a site saver ;)

(Patch from #10 / #11)

#17

asak - November 19, 2008 - 21:32

Is there a special reason why the token [catpath-raw] isn't working?

I can see it in the Replacement patterns for the "catalog path" in pathauto, and would very much like it to work with taxonomy menu!

;)

#18

Falldog - December 4, 2008 - 04:19

Subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.