Posted by mshaver on October 30, 2007 at 8:55pm
11 followers
| Project: | Node Relativity |
| Version: | 5.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Is it possible to show the parent nodes of a content type in a view with their children listed next to them. It seems possible to display only the children of a particular node through arguments, but if I want to list all parents and their associated children, I can't figure out how to do this?
Comments
#1
Have you figured this out yet? I need the same functionality.
#2
I ended up using the viewsfield module with arguments. Both Node Relativity and Views Fusion were not working for me? The viewsfield module works pretty will, but you have to set the child nodes up with a nodereference to the parent. Then you can use arguments to display only those children with the nid of the parent.
#3
Here is a patch that implements this functionality. To use, edit your table view and add the "Relativity: Child Title" field. This patch has been working for me, but is still an alpha version, so be sure to test before using on a production site.
#4
Awesome...
Thanks for the patch it seems to be working just fine at this point... Wow it's like christmas come early...
This is exactly what I needed...
I really appreciate the post... thanks....
Daryl
#5
I'm trying to figure out how to limit the # of children titles that appear in the table view, is there a way to do that?
Preferably the most recent 1-3 that were created...
I'll look into the code.
Daryl
#6
You can accomplish this by replacing the line:
$result = db_query("SELECT rel.nid, n.title FROM {relativity} rel INNER JOIN {node} n ON rel.nid = n.nid WHERE rel.parent_nid = %d ORDER BY n.title ASC", $data->nid);with:
$result = db_query("SELECT rel.nid, n.title FROM {relativity} rel INNER JOIN {node} n ON rel.nid = n.nid WHERE rel.parent_nid = %d ORDER BY n.created DESC LIMIT 3", $data->nid);Additionally, if you want to sort based on the modification date rather than the created date replace
ORDER BY n.created DESCwithORDER BY n.changed DESCYou can also change how many are displayed with the
LIMIT 3argument.Hope that helps!
#7
Great! I was just about to code this exact thing. Thanks!
I can confirm it works for 5.x-2.x-dev (except don't try to sort children inside views). Thanks also for the extra effort getting pathauto compatibility in there too.
#8
Awesome, thanks for the help, I'm kinda new to coding.... It works great.
#9
Subscribing. Greetings, Martijn
#10
Subscribing.
#11
Tracking.
#12
subscribing
#13
Hello, Would this also work for version 5.x-2.4? I would like to try this.
#14
It should, I have been using this patch on updated versions of relativity.
#15
Will this patch be included in the D5 release???
#16
@15: I'd say it's unlikely at this point. Drupal 5 support is coming to an end and most maintainers are fixing critical bugs only in D5 modules.
#17
I've never added a patch before, I'm assuming that you tack that code onto the end of the .module file?
Thanks.
Okay, that didn't work... Can someone tell me where specifically I should add this code to the module files?
Does that SQL query get me to the same place? And if so, where would one add that? I don't see a line like the one described.
#18
#17: http://drupal.org/patch/apply