I am planning to refine the menu code in Taxonomy Menu(it is currently a golden example how menu code should NOT be written) and I have a few questions I would like to ask you guys:
1. Would you prefer the path to be category/1/2/3 or category/3?
2. Do you use terms with multiple parents?
3. (this is for my personal understanding) Why are readable paths so important for you guys? the user is still gonna click on a link to get to the item, 99% of the users I know don't even read the url(don't worry the pathauto patches I've seen around here are great, gonna apply one of them soon)
4. Feature you miss most? I already know about Views integreation and pathauto integration. Anything else?

I hope the answers to these questions will help me make the module a bit better

Comments

no2e’s picture

@ 3.)
Well, 99% of the user I know love human-readable URL's. They are often shorter. You know, to what information the link leads. Search engines love them. You can't mistype them (telephone, TV, friends, print, ...). You can memorize them easier. You can "browse" by url (go directorys up by deleting everything after the last slash).

soliaris’s picture

#4). Missing features:

1. Node breadcrumbs and taxonomy term inside node. It seems module is setting breadcrumbs using this module. It is fine. But taxonomy terms displayed inside node are still referencing to taxonomy/term paths. It is inconsistent.
2. While displaying node, taxonomy menu wraps out. So if I have navigated through menu to see nodes, and by clicking node, all menus are wrapped
3. Node breadcrumbs. If I have one or more vocabularies, module is setting breadcrumb for node from on vocabulary. So it is strange if I have navigated through menu using one vocabulary, then selected node, and I see breadcrumb path from other vocabulary.
4. Integration with views is very important.

I really hope this module will be fixed up, as not many good alternatives exist to setup taxonomy menu navigation.

Best regards.

Afief’s picture

Solaris, Could you elaborate on #1 I don't understand what you mean.

As for #3, I don't see a solution for this since there is no way to know what link the user pressed to get to a node(and what if he pressed no link at all?) If anybody has an idea on how to solve this please let me know.

soliaris’s picture

1. Taxonomy menu is creating nice menus with path like category/1/2/3. It is fine. While navigating from menu, I see breadcrumbs with same paths: category/1/2/3 - it is fine. Then selecting node using menu - I also see node breadcrumbs like category 1/2/3. But inside node page I see node description and all terms listed with path taxonomy/term/... . So if I am using links from menu and from breadcrumbs for my navigation - it is ok, but once I am clicking taxonomy/term link inside node - then I am not anymore on taxonomy menu navigation and I am somewhere on pages which are made by Drupal taxonomy navigation. So idea is to have consistent navigation in all the way.
3. If it is not possible, when I would like to have a choice which vocabulary to use to set up breadcrumbs for node view. Now it somehow random.

soliaris’s picture

One way to solve #1 from my list is to use taxonomy redirect module http://drupal.org/project/taxonomy_redirect. But it redirects to paths like vocabulary_name/TaxonomyTermID. So it cannot handle paths from taxonomy menu like this category/1/2/3. If taxonomy menu path would be like category/vocabularyID/TaxonomyTermID, then everything would be ok. So I would like to see paths from taxonomy menu is such syntax: category/VID/TID.

BR,Soliaris

summit’s picture

Hi,
I am on Drupal 5, so please also update the 5 branch with great features.
A feature I would like to vote for is setting the menu-item names user-build with depth as option to use different category names on different levels.
See: http://drupal.org/node/302394 this way hierarchical website building comes in focus of drupal!
Thanks in advance for considering this!
greetings,
Martijn

Afief’s picture

@Summit:

How about the pathauto way?
category/fruit/apple/green intstead of category/1/2/3? is that a solution?

I obviously don't understand your request very well.

@Solaris:
Overwriting the taxonomy.module's router is quite dangerous as many users might still need regular taxonomy terms in addition to the menu.

summit’s picture

Hi Afief,
No I am needing functionality like:
category/fruit ==> category = in for my needs
fruit_category/apple ==> fruit_category = in_region for my needs
apple_category/green ==> apple_category = in_place for my needs.

This is needed because I need to be able to set a different view/panel-page for different level of taxonomy depth to get a hierarchical setup.
May be something in .htaccess is doable (http://drupal.org/node/121513#comment-515661 ), but how to set up from different taxonomy_menu hierarchy.
THis is not working, but maybe something like this

RewriteRule taxonomy_menu/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)$  ./in/$1
RewriteRule taxonomy_menu/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)$  ./in_region/$2
RewriteRule taxonomy_menu/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)/([A-Za-z0-9_()øàáâäãèéêëìíîïòóôöõùúûüçñ\xa0-\xff\ ]*)$  ./in_place/$3

Thanks in advance for your quick reply!

greetings,
Martijn

soliaris’s picture

Thank you for your answer Afief. Is it possible to have path from tax_menu like this: category/VID/TID? I was playing little bit with tax_menu code, so at least breadrcumb for node I managed to achieve, but with menu items not yet. I believe it should be simple.

BR,
Soliaris

derhasi’s picture

wasn't it possible to build a

 function taxonomy_menu_path($term, $op = 'default') {
  $function = "taxonomy_menu_path_".$op;
  $path = $function($term);
  return $path;
}

so you can give a $op to select which method you want to use for your path. So it was extendible for multiple cases. (perhaps also using module_invoke_all for modularity)

Afief’s picture

@Solairs:
Category/vid/tid or even Category/tid would indeed be much easier to implement(and it would be more conforming to the D6 menu system) but that would break backwards compatibility. You'll notice one of my first questions was if anybody is married to the category/vid/tid/tid/tid... path

@Summit:
My guess would be that giving an option for what view to call on each level(or even for each term) would be a better solution for you than changing the names.

@derhasi:
Sure it's an option, but wouldn't that be a bit of an overkill? a simple switch($op) could do the job more easily IMO. Anyway I have yet to implement the views support(and without API documentation for Views2 that's a tough job) but right now I'm trying to fix the bad use of the menu system.

Thanks for all of your input guys I appreciate it

hutch’s picture

Can you work in Category/vid/tid as a configurable option? Then backward compatibility can be allowed for.

derhasi’s picture

Afief, let me know, when I can help you, I#m available in IRC (#drupal or #drupal.de) too. Allready posted some suggestion for the new menu system: http://drupal.org/node/304379

summit’s picture

Hi Alief,

Thanks a lot again for your quick answer!
Yes please, an option for what view/panel-page to call on each level would be great!

Greetings,
Martijn

netbear’s picture

In the current version of taxonomy_menu on the terms pages i had always breadcrumb "home" and that's all. My temporary desigion to change this was:

function _taxonomy_menu_page() {
  // Check if the Vocabulary ID is set
  if ($vid = arg(1)) {
   $breadcrumb = array();
    $breadcrumb[] = l(taxonomy_vocabulary_load(arg(1))->name, variable_get('taxonomy_menu_display_page', 'category') .'/'. 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)) {
// ---------------------------------------------
        $terms = explode('/', $_GET['q']);
        array_shift($terms);
        array_shift($terms);

        $string = '';
        foreach($terms as $term) {
          $string .= '/'. $term;
          $breadcrumb[] = l(taxonomy_get_term($term)->name, variable_get('taxonomy_menu_display_page', 'category') .'/'. arg(1). $string);
        }

It's ugly, but works for me.

Afief’s picture

@netbear:

Weird, I have tried every configuration I can think of with 1.01 and I always get a breadcrumb...

Anyway it seems that this module needs a complete rewrite as it is impossible to fix it one part at a time(thanks derhasi)

netbear’s picture

Another bug, with counts of nodes- i submit new nodes but in menu i see old datas (you can watch this yourself here:
http://fsu-expert.ru/category/1/1/4/13/240) As you can see the quantity of nodes is 4 but in the menu it's 7.
Also there in breadcrumb is my patch working and if you will go to the node page you'll notice some terms have missed from the breadcrumb...
I see hook_nodeapi in module and taxonomy_menu_taxonomy() where menu_rebuild() is called and i tried to update nodes and terms- nothing changes.

The only thing i done is replased the parent item of the menu from navigation to another menu. May be this is the couse?

Also many times per day i have lots of red pages with "duplicate entry .... insert... menu_router ....."

I agree that this module need to be reworked.

netbear’s picture

Now you won't see difference in count and menu item title because i've uninstalled module and installed it again and created new menu, put the parent menu item there and it shows correct results again. Tried to create and delete nodes and it works correctly- count changes. I don't get what was wrong, but now it wors as it should work.

netbear’s picture

And now it's happend again:
http://fsu-expert.ru/category/1/1
look at menu and under it the right count.

Afief’s picture

I really don't know what I would be looking for, I don't even know what language that is.

edit: perhaps you could find a way to reproduce it? it's an old saying that a reproducable bug is a solved bug.

hutch’s picture

My guess is it's Russian, but the numbers in the brackets are not the same as I guess they should be. the code looks like it's produced by line 188 taxonomy_menu.inc
$name .= ' ('. $num .')';
this is generated by $num = taxonomy_term_count_nodes($term->tid);

Why it's there twice I'm not sure and why they are different is also a puzzle ;-(

Perhaps one of them is generated by taxonomy_menu and the other by taxonomy itself, possibly taxonomy_render_nodes()

It's too late right now to get into further digging

netbear’s picture

Guys, thanks a lot that you droped your sight into my problem. This site is made for russian education ministry and taxonomy menu is applied to display federal lists of manuals recommended to people by ministry. And what is seen there is the menu(blue color)- it's located in the block above the black title of the page, also created by taxonomy menu module. The menu items and title for the page are created using the same formula but display different numbers in bracets, so i guess the title of the page(big black) is not cached because when i add new node it's also display count+1 in bracets and when i delete the node it substracts 1 too but in the menu structure(blue) allways the same number(1103) so it's cached somewhere and not refrashed.

hutch’s picture

Great, thanks for such a prompt reply and good explanation.
I suspect you are right, it might be caching.

What happens if you go into admin/settings/performance and click on 'Clear cached data' at the bottom?

netbear’s picture

Thanks for the reply, Hutch!
I tried to clear cache data as you sad. But nothing changed. You can look for yourself
http://fsu-expert.ru/category/1/1
What else can i do?

hutch’s picture

Try going into site building -> menus -> navigation and edit a menu item and save, you don't need to actually change anything
If this does it then it means that menu_rebuild() needs to go into code somewhere.

netbear’s picture

Thanks one more time, i've done it but doesn't help. No changes again. Can it be because of I moved the parent item from navigation to the menu created by me to display it in separate block cause i needed only lists of books in the block not the whole navigation menu?

hutch’s picture

I installed a fresh copy of D6 with taxonomy module and added the devel module which has the ability to generate dummy data.
I have added, removed, unpublished and republished nodes, added them to different terms and the numbers are always refreshed
So far I am stumped, I don't know why your data is not refreshing properly ;-(

netbear’s picture

Thanks for your help one more time, hutch!
In my turn here is what i did:
1) Installed fresh copy of drupal 6.4
2) Created vocabulary several levels deep
3) Created nodes( my manuals) and binded each of them to the vocabulary terms(one term for each node)
4) Installed taxonomy_menu module
5) Choosed the vocabulary on the settings page of this module
6) Created new menu on the menu administration page
7) Replaced the parent item of the items created by taxonomy_menu from navigation menu to the newly created menu
8) Looked at the pages with adresses "category/...."- everything ok
9) Added some manuals to the list, removed some (added twice by mistake for example)
10) The result you see now on my site- wrong datas(counts not equal in the page title and in the menu items, page title shows correct number and menu item shows wrong)

After i discovered this mistake i reinstalled taxonomy menu, installed it again, repeated steps 5) - 8)
Found that results are correct. Started to add manuals, edit tham and delete some again and discovered that there are mistakes again in counts.

So what is wrong and where is mistake?

netbear’s picture

By the way, i noticed on the last level of the vocabulary the counts changes and one level before it's changed too and before that it is correct too.
But on the first level (my vocabulary is 4 levels deep) it is not changed and is wrong.

hutch’s picture

I will attempt to reproduce this on my test rig, probably tomorrow as it is a really nice day and we have had the worst summer I can remember......

OK, I got my test rig going, using the devel module to generate some dummy data. This is one term per node. I manually counted how many nodes there were in each term

co (vocab)
--munagemi (13) 13 Nodes
--uupabe (7) 7 Nodes
--wratroclonub (24) 6 Nodes
----clugus (13) 8 Nodes
------desw (5) 5 Nodes
----bicle (5) 5 Nodes
--mihuka (3) 3 Nodes
--pecuveb (1) 1 Nodes
--mebrethotha (1) 0 Nodes
----tachow (1) 1 Nodes

as you can see the number in brackets is the total of all the nodes below, not just the term, somewhat confusing

If deleting is not updating, make sure you are using the version from CVS
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/taxonomy_menu/
select DRUPAL-6--1-01 and download
taxonomy_menu.module
taxonomy_menu.install
taxonomy_menu.inc
and put them in your dir

perhaps that will fix the delete bug

I also found that installing the menu_breadcrumb module improved the breadcrumb somewhat.

I will keep playing with this.

summit’s picture

Alief,
I solved my issue :)

greetings,
Martijn

netbear’s picture

Big Thanks to you, hutch.
I see that your test shows correct work of the taxonomy menu, but i have insalled version 1.01 before my post. And as i allready writed there is mistake in the counts of the first level of the vocabulary terms.
Everybody can see it on the page: http://www.fsu-expert.ru/category/1/1
If manually count 804 + 244 + 25 + 31 = 1104 , not 1103 which is shown in the menu. But the title of the page shows 1104- correct result.
Also if i add new node, not only delete in the menu stays 1103 and it never changes, though the title of the page changes and shows allways correct number.

Besides, when i add new node or delete it, the lower levels of the menu show correct number, for example 804, 245, 25, 31 when i add the node to subterm of the second term.
And lower levels then that are all correct too. The problem is only with the first level of the vocabulary.

ganymede-1’s picture

hello Afief, briefly:

I really appreciate your work, I think it is fundamental

- taxonomy links should be easily created in one or more new dedicated menus, not in "navigation menu" (which, as drupal itself says, is often not visible to guest/not authenticated users), as the default of the current version

actually, I know that this option is already possible, but it is little tricky and confusing (you have to "manually" create the menu, the edit the first-level taxonomy menu items in navigation menu to attribute them to the respective correct menu)

- and a question: pathauto integration would give also global redirect integration, as an automatic consequence? this result could be as important as pathauto integration

thank you very much, you did really good work, I think that your excellent "taxonomy navigation" should be in the core (together with other functions)

ganymede

summit’s picture

Hi,

Just giving vote to keeping category/1/2/3 with the ability to change this per vocabulary to category/3
As answer on: 1. Would you prefer the path to be category/1/2/3 or category/3?

The reason why I would very much also have the opportunity to use category/1/2/3 is that this gives a hierarchical option to use the 1/2/3 for hierarchical website.
I use it on www.wintersport-accommodaties.nl (site not finished yet). But with the ability to see what the depth of terms is through 1/2/3 I can build hierarchical templates.

So +1 for keeping the option for 1/2/3 and the ability to change this per vocabulary to whatever you like as "category" verb and the ability to change 1/2/3 to /3.

Thanks in advance for considering my humble opinion about this.

greetings,
Martijn

MCNet-1’s picture

1. category/1/2/3
2. Yes
3. Yes, important. Exactly for me, but maybe not for users.
4. Now Views and Pathauto integration is more than enough for me :)

vlooivlerke’s picture

1. category/1/2/3
2. Yes
3. No, not if I can use Pathauto
4. Views and Pathauto integration will be great

If I could add a no# 5

5. Hide the root menu

What is the point to have a Vocabulary called "Category" with Tems Cat1, Cat2, Cat3, but if you set it to Primary Links only the Category menu link show. I would love to have Cat1, Cat2, Cat3 be my primary links.

Same with secondary menu links.

vlooivlerke’s picture

Sorry!!

5. Hide root menu is already implemented.

Thanks it works great.

It is called: Item for Vocabulary (Shall the vocabulary have it's own item)

You must un-tick this option to hide the root menu item.

indytechcook’s picture

Version: 6.x-1.0 » 6.x-2.x-dev

Great comments everyone!

The first version of the write was completed with limited functionality (no path support or category/1/2/3). A handler concept was introduced that I've been told was a little to complicated (see #375137: Remove monolithic functions, replace with small single-tasked functions). I agree with the over complicated so I am going to summarize here what my ideas are and let the group comment.

  • Move all options to the vocabulary edit page and make them per vocab.
  • Path: derhasi and afief idea of using taxonomy_menu_path to invoke a custom path. I love this. This is staying for sure. This is in the current dev version (just within the other handler code). The list of path options will a selected drop down. If tokens are enabled, then you will be given the option to use tokens. If the field is filled in, then it overrides your path drop down selection. If using tokens, then there will be an option for vocabulary and term patterns.
  • Hooks: A hook will be invoked to edit an $item array before it is saved. This will be used for editing the title to display the number of posts.
  • Link creation: The links will be passed through l() before saving the menu. This will apply any path alias.

From a views integration perspective, you can just use the set the path on the view to match the path of the term. What other integration is needed?

I don't think "pathauto" has to be specifically implemented. Using l() will fill in any alias created by the pathauto module.

I'm trying to decide the best way to do the page display. Using the default path of taxonomy/term/tid, the page and breadcrumbs are handled by the taxonomy module. If we customize the path and do not use the views there will have to be an item in the menu_router (categroy/%) to handle the page and breadrumbs.

Do we let other modules handle the breadcrumbs and page callbacks and stick to the menu only? I don't think so. Being that one of the goals for this module is to make it to core, it needs to rely on as little as possible.

Do people use the display descendants functionality?

Thank you for all of your patients and support.

indytechcook’s picture

Hello Everyone.

The new version of Taxonomy Menu is moving along nicely. Here are my notes for the latest commit and DEV package.

Added 4 hooks.
hook_taxonomy_menu_path
hook_taxonomy_menu_insert
hook_taxonomy_menu_update
hook_taxonomy_menu_delete

hook_taxonomy_menu_path: Returns an array of the functions and titles that are displayed in the path drop down. The function is then called when a taxonomy menu item is added or updated. It is passed $tid, $vid and then return a string.

hook_taxonomy_menu_insert: Takes and $item array, makes edits to this array then returns the edited array
$item
array with the following key/value pairs:
'tid' => the term id (if 0 then updating the vocab as an item)
'name' => new menu name
'description' => new menu description, used as to build the title attribute
'weight' => new menu weight
'vid' => the new vocabulary's id
'ptid' => the new parent tid
'remove' => if this is set to TRUE then the $item is not added as a menu

hook_taxonomy_menu_update: Same as hook_taxonomy_menu_insert except adds an 'mlid' element (current menu id).

hook_taxonomy_menu_delete: Returns nothing. Is called when a taxonomy_menu item is about to be deleted.
Parameters:
$args
array(
'vid' => Vocab ID
'tid' => TermID
'mlid' => Menu ID
)

How to Use Views/PathAuto (partial tested):

  1. Create a view.
  • The first argument is $vid and the second is $tid and allow multiples.
  • Create a page display with the path 'category/%' (or whatever you are going to use as the base of the path)
  • If using PathAuto and you haven't bulk updated the alias yet, then do that now at admin/build/path/pathauto
  • Edit the Vocabulary
    • If you already have a menu then select 'Select to rebuild the menu on submit.' and press 'Save'
    • If you haven't created a menu then do so now

    I realize this is not a perfect integration but it works. I have plans to do this but wanted the communities opinion if it is needed. Please share your thoughts.

    Thanks,
    Neil

    indytechcook’s picture

    Status: Active » Fixed

    As the new version is out and nearing the first release, I am setting this issue to fixed.

    I have created development documentation at http://drupal.org/node/380652.

    Thanks,
    Neil

    Status: Fixed » Closed (fixed)

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