User login

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

http://pingv.com/blog/matt-tucker/2008/drupals-views-module-unleashes-new-power-website-administrators

Resolution

Searched words: 
views 2 link to other content type in same taxonomy term views 2 relationship another content type same taxonomy term views 2 relationships node term Drupal Views 2 pass relationship as argument Drupal Views 2 "custom relationship" Views II double-jointed relationships examples

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

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.