Posted by stevepowell on April 28, 2008 at 10:37am
Jump to:
| Project: | Taxonomy VTN |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | AlexisWilke |
| Status: | active |
Issue Summary
hi, great module - but under the setting "Where we go on click a term:" I would expect to see also the possibility to go to a vtn listing for that term, i.e. displaying child terms if there are any, rather than nodes. The display could be just the same as for taxonomy/vocabulary/x. This would seem to be the logical setting for deeper vocabularies with subnodes, sub-subnodes etc.
Comments
#1
Hi,
I think that, better way is use synonyms to term
i try implement exactly idea like is in real book (only we should choice a vocabulary)
then we see terms and synonyms and is possible to go to nodes for this terms or synonyms
Ok, i'm opened for ideas but better choice is show me the code for your think.
I don't have much time to implement all user ideas.
I live this issue opened because maybe i future this be implemented :)
thanks for issue.
// If you want have a voc->term->term child->node
// use category module i think that this able to do your think.
#2
Hi! And thank you for the module!
It's really very good one already but... any chance of getting tree view for this module? It would be absolutely great to see its display changeable from plain to tree or (more wanted by me) wiki-like "mixed" tree with childs and pages separated at the same parent page (eg http://en.wikipedia.org/wiki/Category:Content_management_systems). It would be very appreciated.
Thanks in advance!
PS I've changed issue status but ff to postpone it again.
#3
Ingumsky,
This is assigned to you now... Does that mean you are going to propose a patch? If not, you should not assign the issue to yourself.
I think this is an interesting concept. I guess the top index should only show root items, and any other would show children if any and nodes. Does that sound like what you have in mind?
Thank you.
Alexis Wilke
#4
AlexisWilke
>> This is assigned to you now... Does that mean you are going to propose a patch? If not, you should not assign the issue to yourself.
Yep, it was a bad idea. Sorry, Alexis. I'm still rookie not pro so there's no real chance to see me updating a patch...
>> I think this is an interesting concept. I guess the top index should only show root items, and any other would show children if any and nodes. Does that sound like what you have in mind?
Yes, absolutely. This is what Wikipedia categories provide and what I wanna get. I can see the way to realize that but I can't move 'cause I'm not a programmer — just a terp.
#5
Okay, this is now available. You have a flag in your taxonomies to turn on in order to get the function to work.
Then you will get a nice breadcrumb and everything looks just great.
Note that all the pages are still available, this is just in addition. So if you have links to the old pages, your site will still work.
Thank you.
Alexis Wilke
#6
And even marking this fixed now! 8-)
#7
Automatically closed -- issue fixed for 2 weeks with no activity.
#8
I've tried brand new 6.x-1.3 and found out that the function doesn't work properly. I have a taxonomy tree География (Geography, id=2). I enabled the checkboxes "parent/child links" and "show parent in a child links" with desire to see wikicategory-like pages for the voc. After that I cleared the cache. Now:
1. The link from voc index (http://www.liverbird.ru/taxonomy_vtn) to the voc page is http://www.liverbird.ru/taxonomy_vtn/voc/2/0/1 not http://www.liverbird.ru/taxonomy_vtn/voc/2
2. There're some terms missing here (all started from first letters of cyrillic alphbet - А, Б, В).
3. Node/term counters wrapped in brackets show wrong numbers (see Ирландия (Ireland) http://www.liverbird.ru/taxonomy_vtn/voc/2/43/1 - there's six child terms not just one!)
4. There's no nodes on the pages — terms only (http://www.liverbird.ru/taxonomy_vtn/voc/2/43/1 with a lot of nodes tagged with "Ирландия" we can see only its child terms).
Am I missing something? Please give me an advice. Thank you!
#9
Ingumsky,
The "show parent in child links" gives you a link to the list of nodes for that term (which kind of would solve the problem pointed out in #4). Last time I tested it worked for me... let's see... Yes, still working here:
http://linux.m2osw.com/taxonomy_vtn/voc/1/241/1
And on your site, I see Ирландия in that list:
http://www.liverbird.ru/taxonomy_vtn/voc/2/43/1
which is about Ирландия.
This is the page about "operating system" and you see it in the list with 59 nodes. If you click on it, it will show you the nodes for "operating system". Yet, from the root, clicking on that term would not show you the nodes.
Point 3. counters... good point, the number shown is the number of nodes, not the number of children terms... I guess it would make sense to have the number of terms when the term shown is a parent... but if you want point 4 at the same time, we may have to show two numbers... (# of children/# of nodes)
The qualified link:
http://www.liverbird.ru/taxonomy_vtn/voc/2/0/1
will only show root terms for vocabulary #2. To see children terms, put 10 at the end as in:
http://www.liverbird.ru/taxonomy_vtn/voc/2/0/10
The link modification (i.e. with voc/2/0/1) is because you are asking for parent/child browsing. And to me it seemed logical to do it that way from the root. I guess we could have yet another flag to define the root link... (that's makes the setup look more and more complicated!) Or instead of a flag, a depth from 0 (i.e. use just voc/2) to 10 (i.e. use voc/2/0/10). That way would work nicely since you could choose the level for the root index.
Let me know whether that makes sense.
Thank you.
Alexis Wilke
#10
Thank you for response!
Maybe I wasn't clear with the idea so I'll try to explain in two steps — what I expected and what I have.
Expectations:
1. My idea was to see all (and only) top-level terms in root with possibility to run through child terms level by level.
ex: http://en.wikipedia.org/wiki/Category:Footballers_in_England_by_club
2. There would be child terms (if any) and nodes (if any) at the same time on every term page.
NB: only nodes tagged by this term itself and only its child terms of next level!
ex: http://en.wikipedia.org/wiki/Category:Liverpool_F.C._players
Current situation:
1. The link from master index to voc index was modified to satisfy my needs expressed with "parent/child links" checkbox.
ex: http://www.liverbird.ru/taxonomy_vtn
2. Now I have discovered why some terms (primarily started with А, Б or В (first three letters of cyrillic alphabet) were missing. Tax VTN thinks that those terms are empty. I enabled "show empty" checkbox and they are visible now.
ex: http://www.liverbird.ru/taxonomy_vtn/voc/2/0/1
3. There're two types of links for terms - the first one for childless terms (/taxonomy_vtn/term/338) and the second for those with children (/taxonomy_vtn/voc/2/49/1)
4. Counters show irrelevant numbers — some terms are even 'empty' as I've mentioned above. But I have no idea why they are 'empty'. There's huge hierarchy and 575 nodes tagged by "Великобритания" (Great Britain, /taxonomy_vtn/voc/2/73/1) but it's 'empty'. Term 'Ирландия' (Ireland, /taxonomy_vtn/voc/2/43/1) has 6 children and 23 nodes attached to itself but its counter set on '1'. Term 'Словакия' (Slovakia, /taxonomy_vtn/voc/2/67/1) has 1 child and 1 node but counted as '2' and so on... I think there's a bug but I cannot catch it.
5. And now about term pages. All pages with /taxonomy_vtn/term/term_id link (see above) work fine. They have no children so you can see nodes.
ex: http://www.liverbird.ru/taxonomy_vtn/term/338
6. Every page with /taxonomy_vtn/term/voc_id/term_id/depth(?) link (see above), i.e page for term with children look strange:
ex: http://www.liverbird.ru/taxonomy_vtn/voc/2/73/1
6.1 There's a list of sub-terms and one of them is parent term itself (/taxonomy_vtn/term/term_id/term_id) refering to list of nodes. So while browsing "Great Britain" page you can find not only child terms like "Northern Ireland" or "Scotland" but 'term' "Great Britain".
6.2 Counters for child terms show irrelevant numbers (see 4), counter for fake 'child' works fine.
6.3 Term page has title 'Terms in voc_name' not 'Nodes in term_name' or 'Terms in term_name'.
7. There's almost identical behaviour on my local machine (test installation) and on production site mentioned in examples.
And here some questions:
1. Is that behaviour described at 'Current situation' is normal and planned by design?
2. If so is it possible to meet my 'Expectations' in future?
3. Are there any solution or workaround to fix 4? How can I help to find it?
Thank you for your patience and sorry for my English.
#11
Ingumsky,
You have an excellent English in comparison to my Russia... 8-)
Point 2 & 4 of the "current situation" are bugs and they need to be fixed. (Note: Point 2 of the current situation and Point 1 of your expectations are the same problem.)
Point 2 of your Expectations is doable. You have to realize that there are two functions: one to show a list of terms and another to show a list of nodes. What you are asking is to merge them both in some ways. For this I have a question:
Do you want a list of child terms, then a list of nodes, or do you want both mixed together as if it were one list?
Now if you can program in PHP, I'll welcome your help on point 4. At this time it is "only" counting nodes. What we need is to count nodes & child terms and also we need to make sure (and that's probably one of the bugs) that the counting does not take the parent/child in account. (I would be surprised that it does, but I'm not 100% sure.)
Thank you.
Alexis Wilke
#12
Spasibo, Alexis ;)
>> Point 2 & 4 of the "current situation" are bugs and they need to be fixed. (Note: Point 2 of the current situation and Point 1 of your expectations are the same problem.)
I think that cs.p2 & cs.p4 are representing the same bug with counter but I cannot put cs.p2 and e.p1 in touch with each other. Why do you think it's the same issue?
>> Point 2 of your Expectations is doable. You have to realize that there are two functions: one to show a list of terms and another to show a list of nodes. What you are asking is to merge them both in some ways. For this I have a question:
>> Do you want a list of child terms, then a list of nodes, or do you want both mixed together as if it were one list?
Yep, sure I know that. I think separate lists for child terms and nodes would be more useful for end-users.
>> Now if you can program in PHP, I'll welcome your help on point 4. At this time it is "only" counting nodes. What we need is to count nodes & child terms and also we need to make sure (and that's probably one of the bugs) that the counting does not take the parent/child in account. (I would be surprised that it does, but I'm not 100% sure.)
I used to program in Perl but some years have passed since. I'm not quite sure I can program in PHP but I've already written some simple modules for my site. So at least I know something about drupal structure, can read the code and look for bottle necks and some issues in algorithms. And of course I can test the code on my machine.
Thank you!
Ivan.
#13
cs.p2, as you mentioned, is "fixed" with the use of "show empty". Terms should not be considered empty if they have children and we are in parent/child mode.
e.p1 is not showing all the root terms because the module only check whether they have nodes, not whether they have nodes or children terms.
That should be easy to fix and will include the count of terms for the parenthesis.
Thank you.
Alexis
#14
>> cs.p2, as you mentioned, is "fixed" with the use of "show empty". Terms should not be considered empty if they have children and we are in parent/child mode.
OK. Now I see why you have said they are the same.
>> e.p1 is not showing all the root terms because the module only check whether they have nodes, not whether they have nodes or children terms.
Hmmm. If so this checking fails because my 'empty' terms have and childs and nodes.
Thank you, Alexis.
#15
Okay, I checked in a new version.
1) Added code to count the number of term children
2) Fixed an "optimization" that would skip the counting of the number of nodes in case we have term children
3) Added the # of terms in the parenthesis as in: (# terms/# nodes). So for instance you may see (3/7) after a term.
4) Added one more stat with the total number of children terms since it was very easy.
You should see a Jul 18 version at some point. That should have these changes. Let me know if it works for you as expected.
Thank you.
Alexis
#16
Thank you, Alexis!
It definitely works with either "show empty" option disabled or enabled. Nodes and terms are counted as they should be.
The only issue is in statistics at the bottom of the page:
"references to children" has incorrect value - there are 3 children counted when actually there should be at least 4 (number of child terms at next level) of them, sometimes there just one child term counted with 5 terms of next level (and all deeper ones) unnoticed.
"references to nodes" counter works perfectly.
Ivan.
#17
Ivan,
Good. 8-)
I have noticed that if you had the "Show parent in children's list" then the counter would be 1 off for any parent that has a child.
I removed the term counter if there isn't any (0/3) -> (3)
I added support for the nodes to appear after the terms, see "Show parent nodes after the terms if any" in the taxonomy settings.
Let me know whether anything else is missing. There should be a newer version soon, I'm afraid the date will remain the same. The size should change, however... the current size is 65.67 KB. Once the newest changes are in, it should be different (a little higher).
Thank you.
Alexis
#18
Thank you, Alexis!
It's fantastic work! Yes, it really is! It works as it should!
So there's only one problem now — and it's with "references to children" counter (see #16).
And I think there's some design issues with the Tax VTN term page — title of the page should be modified to reflect nodes+children mode enabled (now it's "Nodes of term ..."), initial letters and header for nodes section should be added.
Thank you very much!
Ivan.
#19
Ivan,
For the counters, do you show synonyms? If so, then the count would be wrong because there is only 1 term and 4 synonyms... If you don't show synonyms, then that's not the problem.
Thank you.
Alexis
#20
>> For the counters, do you show synonyms? If so, then the count would be wrong because there is only 1 term and 4 synonyms... If you don't show synonyms, then that's not the problem.
Yep, "show synonyms' option is enabled. But actually I have no synonyms at all.
Thank you,
Ivan.
#21
Say I have this list:
Home › Master index › Tags › video › TV
When I get to TV, it will shows me every node that have TV in it.
Is there a way to filter it so it only show node that have both the term Video and TV in it?
#22
Hi EkaMei,
Interesting idea, but the code is not working that way. It shows all the nodes with TV because you have selected the TV term. The parent is ignored.
If we were to take the parent in account, you'd miss many nodes in your index or you would also need to have access to "... > Tags > TV".
Thank you.
Alexis
#23
I understand that it would miss many nodes, but if this is not intended for being a grand index, rather, using Taxonomy as it was intended for category purposes.
The parent / child relationship will let you refines the term to make a very sophisticated directory.
Of course. I also understand that Taxonomy, especially the way VTN is made, is more for a dictionary purpose. I just think a feature like this would easily make VTN to fits both and there, at the moment, isn't really any option in Drupal for a directory beside the menu system.
Do you think a modification or addition like this would be difficult? I think filtering term like this should be fairly easy and at least deserves as an option.
#24
Not too sure whether it is complicated or not. I'd have to look closer whether the query would be easy to tweak. The info for the query is easy to obtain since it is just a matter of using the child and all of its parent as defined in the breadcrumb.
So I think it would be rather easy to do, yes. Then we'd want to have a flag to choose one or the other mode.
Thank you.
Alexis
#25
At the moment I'm still considering my options for 6.x Drupal.
I checked a few options and found pretty much no valid alternative to archive what I described. Basically a directory. Am I missing something? I am just a little surprised something simple as this haven't been developed for drupal yet.
I'm not new to drupal myself, however. I just recently started trying a more organized approach toward Drupal with taxonomy. If there is a better way to approach this issue, please let me know. And if not, perhaps I can help with VTN.
#26
With the default Drupal taxonomy /term/ you can specify multiple terms. But there is no automatic system that will give you "TV+video". There are tons of modules to play with in regard to terms, although I personally find this one best, there are others that can do similar things.
I had a look and that would take one extra SELECT to get a list of nid that include all the parents. Then we can eliminate all the terms from the current list that are not in the result of that SELECT. If that makes any sense... 8-)
I get the list of terms around line 629 using the standard taxonomy_get_tree() function.
After that call, we have all the terms under the given parent.
As you can see, the if($letter) block will remove all the items that do not match the letter(s). We could do the same thing to eliminate all the terms that do not also match the parent terms. This is done using the term_node table.
SELECT tid FROM {term_node} WHERE nid = <node where the term being checked is defined>This SELECT will return a list of tid and all the parents should be defined in that list. If not, then we remove that term.
Thank you.
Alexis
#27
Thanks for the respond.
I can see that this will help removes the terms, but what about the nodes listed under each term?
Also, I see this on line 1196 in the latest dev:
// TODO: settings for depth , probably use level of terms ?Perhaps someone already thought of what I mentioned, just haven't had the time to do it.
_taxonomy_vtn_select_nodes appear to be what I should be looking at from what I understand, though I'm not quite understanding the connection between $own_tid and parent terms at the moment. Perhaps I need to modifies that function entirely?
#28
Indeed, we'd need to apply the change to the link to the nodes and fix the node function which is the last function in that same file.
By default, the parent term is null. In your case, it is the tid of "Video". In the taxonomy_vtn_show_nodes() function, it is used for the breadcrumb only.
$own_tid is the term that has to appear in the nodes for the nodes to be shown, i.e. TV.
Looking at the taxonomy_vtn_show_nodes() function, it looks like what we'd need to do is expect $arg to be either one $tid or an array of $tid separated by commas (if I recall properly, commas are used when all the terms have to be present and pluses are used when any one of the terms has to be present. So: taxonomy_vtn/123+456 would show all the nodes with either 123, 456 or both. Whereas, taxonomy_vtn/123,456 would only show nodes with both 123 and 456 defined.)
To start with, the if (!is_numeric($arg)) { ... would need to change with first a break down of the parameters to an array. Then we can test each item in the array for validity:
$terms = explode(',', $arg);for ($terms as $tid) {
if (!is_numeric($tid)) {
... // same code for error handling
}
}
Similarly, we need to check each term and make sure they all are valid.
One problem: the page title... at this time, it shows the name of the term, if we have several, we'll have to make sure that it is created with the child most term as it is now.
Then call _taxonomy_vtn_select_nodes() with the array of $tids and 'and' as the operator. The rest should work as is.
Thank you.
Alexis
#29
Wow, you are replying on Christmas day.
Thanks for the help. I will take a look at this and reply when I have a chance to do some testing. Still quite new to doing this line of work.
#30
When you say
for ($terms as $tid) {I think you meant "foreach"?
#31
EkaMei,
Certainly. It would work better, wouldn't it? 8-)
Thank you.
Alexis
#32
Sorry, have to say I haven't manage to get a successful implementation. I probably need more time to read through the code to understand how this really work. A duct tape patch isn't particularly useful for anyone but myself.
Hopefully the information you gave out is useful for someone else who might find this feature interesting.