By martinkong on
Started playing around with the Views module, it's simply amazing how flexible it is. I'm surprised to find out it doesn't have filter for noderefernce field. Any reason for not having that? Is there a patch out there that addes this functionality?
Thanks!
Comments
Looking for same
I need a patch like this too. I'm looking to filter a view to show only nodes that have a value in a nodereference field. I need something that functions the "Taxonomy: Vocabulary Name" filter, but that shows nodereference fields.
sigh
I was hoping that I was just missing something. I'll see if there is a feature request already in place.
Use Argument
I solved my problem, but I can't find the post that helped me figure it out now, so I'll try to describe my solution.
I wanted to create a block that listed every node that refered to the node a reader was currently reading. The framework is a blog that allows writers to post blogs in a neighborhood -- each neighborhood is a node -- and when a reader goes to a neighborhood, they can see all blog posts in that neighborhood. I used nodereference over taxonomy because it allows users to easily add new neighborhoods, and allows for basic stats for each neighborhood.
To create the blocks, I made a new block view, with an argument Node Reference: (field). Then to make it work, I had to add this text to the Argument Code (per the post I can't find now):
if ($type == 'block' && arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
//$node = node_load($nid);
$args[] = $nid;
}
return $args;
I then filtered by taxonomy and node type. The result is that any new neighborhood node will have a block showing posts under each taxonomy term in that neighborhood.
I'm not sure to understand
I'm not sure to understand clearly how you made it work. Could you please give me more details on how to create the block ?
Thank you :)
provide an export of your view?
Any chance you could provide an export of your view?
I used CCK nodereference.
I used CCK nodereference.
I added a nodereference field to the blog content type that refers to my custom content type "Neighborhood." In Drupal 5, you can add custom field to the blog -- in 4 I had to create a custom content type for my blog.
With the nodereference field, I can related blog posts to a Neighborhood.
I then created a custom view, with an argument "Node Reference: Neighborhood (field_neighborhood)" -- this would obviously not say Neighborhood in your View. Then in argument handling code, I entered the following code (not sure where I found this before, but it worked):
Use views to list fields from nodes that are refered from a node
Hi,
Excellent code, it worked perfectly.
I want to do exactly the opposite, that is, I have a node which references to other nodes (using the node reference CCK field), and I want to list fields from those nodes (that are referenced) using views.
Thank you very much in advance
http://www.faunapolis.org/
I'm assuming you mean you
I'm assuming you mean you want to display the view block on the same custom content that holds the nodereference field? If so, well, I'm trying to figure that out too. There's a couple of cck modules that look like they might do the trick, but they're all currently dev. :/
Hey there I need exactly the
Hey there I need exactly the same thing... To be able to list fields from nodes that are referenced from the 'current' node...
Have you found a solution for this? I'm using drupal 5... Thanks
Patchak
Création de sites web
Actualité informatique
Check the bottom of this
Check the bottom of this post:
http://drupal.org/node/86410#comment-1060891
sub
sub
How can I show 'Referenced by'?
My case is a bit different, but I'll use u're exmaple:
Neighborhood node has a node reference (with mutli values) to the Blog node.
How can I show in a block all the Blog nodes that are referenced by Neighborhood node?
Cheers,
Amitai
Amitaibu,
Amitaibu,
I had the same issue. On node/Z, I wanted to display a View listing of all the nodes that referred to it. So if Node/A, Node/B, and Node/C all had a nodereference to node/Z, then on Node/Z I wanted to display those three in a View list.
I did this by creating my own $view object, with this code for the filter:
Thanks for the
Thanks for the info!
---
gizra.com - where cool software developers meet geek fashion designers
subscribing
interested in this
http://www.faunapolis.org/
Subscribing, greetings,
Subscribing, greetings, Martijn
Solution
I blogged about this a little while ago. Here's the link if anyone's interested:
http://amariotti.com/blog/reverse-nodereference-block