I may be being thick.... especially as I have not yet got to grips with views and it seems like it should be simple

Say I have a node type "bio" and other node types such as "concerts" "albums" "mp3_track" etc. All of these node types are associated with a taxonomy "artist" so that bio "David Bowie", mp3_track "Space Odessy" & concert "Munich 1987" are all tagged as the artist vocabulary "Bowie, David".
- No I am not setting up an illegal downloadsite 8¬) it is just an example

I want a view that when at the "David Bowie" bio page (vocab artist="Bowie, David"), it will list all content (e.g. concerts and tracks) allocated to the same term "Bowie, David". Seems simple but I can't figure out how to do it.

In Views "Relationship" there is a relationship for the parent of the current term but not a relationship to the term of the current node?

Using an argument is no good(?) as I am searching on term whilst the URL contains a NID (node ID) not a TID.

Using a filter is no good(?) as it seems unable to filter based on the current node's vocab term.

I do not want to use CCK node reference fields as that will break the functionality of the user creating the term as part of creating the root "bio" page. Plus at that point the term will not yet exist, and the bio page needs (for other reasons) to belong to the vocabulary (e.g. "Bowie, David") rather than just pointing to it.

Do any books go into using the Views module? (other than to mention it almost in passing)

re-cap: I want to list content that belongs to the same term as the current node (whether displayed within a block or panel etc.)

Regards

John Bryan

Comments

catch’s picture

If I remember correctly, there's not yet support for relationships from terms attached to nodes. You could do it with using PHP argument handling, but it seems like a missing feature to me in the views taxonomy support. If I find an existing issue for this I''ll post back.

dman’s picture

I know how to do in in classic taxonomy, but am not sure of the best way in views.
However, you SHOULD be able to deduce the appropriate tid to then use as an argument to views - because argument passing is going to be the direction to go.
Here's a starting point for that:
http://drupal.org/node/257236#comment-842986
This is code that will take you from NID to TIDs
Not sure where the code will go for you...

John Bryan’s picture

Thanks, that confirms the work-around I was thinking of and the example helps. It's just that a work around should not be needed for such a basic relationship type.

John Bryan’s picture

It's frustating.

I use Drupal because of the potential power of the taxonomy system. But the potential is not being realised because of poor editing interfaces (e.g. selecting a term from a large hierarchical taxonomy when editing a node) and more importantly lack of facilities to use the taxonomy relationships. Modules seems to be created left, right & centre to provide attachment, linking and relationship facilities when Taxonomy should already be able to do those tasks with just the aid of core (or virtually core modules in View's case), that's it's purpose.

catch’s picture

John - there's a lot of work going on in taxonomy module for Drupal 7 - both to fix some of the underlying architecture issues and also to fix some of the UI issues for managing terms. I'm hoping this will make the taxonomy-related contrib modules in Drupal 7 both a lot lighter and easier to maintain, and in some cases unnecessary.

If you're using taxonomy even a little bit, then any help testing out those patches could make a big difference (and some of the fixes are going back to Drupal 6 - either to fix core bugs, or backports which are replicated in contrib modules). All the active issues are at http://drupal.org/project/issues?projects=3060&versions=156281&component... - as you can see, some patches are stuck at needs review for several weeks since we have a shortage of people testing and reviewing patches - both in core, and even more so in contrib.

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Taxonomy should already be able to do those tasks with just the aid of core (or virtually core modules in View's case), that's it's purpose.

See, this is where we have a difference of opinion about what taxonomy's purpose is. It's really easy for human beings to envision all kinds of relationships -- we're wired to do that -- but computers need to be told very specifically what those relationships are. I suspect your frustration stems from the fact that something you find intuitive is just not intuitive to the computer, but this happens all the time.

IMO, what you're doing with taxonomy is well outside the bounds of what it was intended for, and you're crying foul when the toolsets don't really support it. That's pretty much unfair to everyone involved.

That said, the ability to create arbitrary relationships is something that can happen in Views 2, but it requires a module that lets you tell Views what htose relationships are. It would be very cumbersome if it just created them all for you (the list would be...long, and slow to generate) and it's not something I intend to put in Views itself but I do hope some enterprising contrib author will create it.

John Bryan’s picture

Possibly a fair point if I have got the point of a taxonomy wrong. What would you say is the purpose of Drupal's Taxonomy mechanism?

merlinofchaos’s picture

Primarily it's a way of categorizing data. While it's true that items with the same term do have a relationship, it is not a direct relationship. In general Drupal doesn't go "I have this node, give me other nodes with the same term", it goes "I have this term or term(s), give me nodes with these terms." There are taxonomy modules that do this -- 'related content', for example, usually picks up terms off a node and gives you other nodes that also share those terms, possibly weighting it such that more shared terms == more related. So people do add that kind of thing as a feature. But that isn't its original intent. This is why it tends to be possible to do what you ask, but not straight-up click a few buttons and it happens.

John Bryan’s picture

In database terms then - it is a bit like creating indexes to database records but not have any native means of using the index for cross referencing. It is the relationships that can potentially provide a massive gain a data organisation and hierarchy but views is not supplied with the taxonomy relationships to perform it 8¬(

John Bryan’s picture

Catch - I will look for back port patches to D6 that I can test. My drupal work is on a customer's semi-commercial public site, when not doing that I'm doing my day job (completely non-CMS/website related), so unfortunately I don't have the luxury of playing with D7 itself.

joachim’s picture

John Bryan -- either switch your system to use nodereferences, so albums, venues, etc point to the David Bowie node directly.
Or use theming to pull in the view of items with the same term: in a bio node's template, get the term, embed a view with PHP code and pass it that term as an argument. You could probably even pass a 2nd argument of the current node's nid to filter itself out.