Relating nodes by taxonomy with Views 2 relationships?
benjamin-agaric: a Views 2 question-- we have two content types (one for images, one for posts) connected to the same vocabulary, we would like a view of the images (actually a CCK field on a node type) where the link from the image goes to the single post tagged with that term. Now I'm thinking this is such an edge case I should just do it in the theme like always. But--
[these next messages were all sent pretty much simultaneously]
merlinofchaos: You probably need a custom field for that.
benjamin-agaric: Would it be possible to make a relationship capability that could take the secondary characteristic of items in a view (in this case, the taxonomy term) and pass it to another view, and have that data available?
merlinofchaos: Or a custom relationship.
merlinofchaos: I don't know about passing it to another view -- that's not something I've given much though to, but if you create a relationship which puts in the proper sql to link one node to another, you can have full access to both nodes in one view.
merlinofchaos: Though, IMO, using taxonomy to relate nodes together is not a good data model, and if you can it's best to use node references.
benjamin-agaric: yeah, I feel it's a little hacky the way we did it here. But where would I find an example of an implementation of a relationship to make a custom one? I'm looking around the views 2 code.
• merlinofchaos tries to think of an example of a 2 hop relationship, which is waht that would be.
merlinofchaos: views_handler_relationship_translation.inc maybe
merlinofchaos: It's the only custom relationship within Views.
merlinofchaos: nodequeue.module and flag.module both are good examples of custom relationships, and content_handler_relationship might be another.
benjamin-agaric: ok, it's very much not worth it. But where are the current relationships defined? Ah, OK, under modules!
benjamin-agaric: awesome, thanks
Background on Views 2
http://drupal.org/project/views
http://views-help.doc.logrus.com/
Relationships specifically: http://views-help.doc.logrus.com/help/views/relationship
Comments
Views Relationships
I read your conversation above, and the issue is pretty similar to the thing I'm thinking of.
The problem is, that a, let's call it: 'term relation' would not help, since there probably are a lot of nodes (or whatever) that are tagged with a given term.
I'm thinking of some kind of 'view relation'.
Imagine this example: You have a primary view that produces a list of nodes of type image.
Now create a second view, that produces a list of nodes of type post that are tagged with a certain term. The second view gets this term by argument.
Now it would be useful if one could put a 'view relation' into the first view, that links to the second view placing some arguments (like the term).
That would be a powerful tool, since you can freely filter, sort, etc.. the second view.
What do you think of that?
PS:
It actually is some kind of two-hop request, but at times it is much more flexible with multiple items...
Post new comment