Download & Extend

Is this module necessary in my situation?

Project:NodeReferrer
Version:6.x-1.0-beta1
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:wrb123
Status:closed (fixed)

Issue Summary

Check out my forum post at http://drupal.org/node/518594. Is this module basically essential for solving my problem?

(To sum it up... Song node references artist. I've been able to use Views 2 to display artist info when viewing a song node, but I've been unable to display song(s) info when viewing an artist.)

Comments

#1

Assigned to:Anonymous» wrb123

no, i actually don't think it's necessary. you should be able to do it with your current nodereference field and a Views2 view.

so, you have:

Type Artist (fields Title, Body, Watever)
Type Song (fields Title, Body, Watever, field_song_to_artist*)
*=nodereference field

try this:

in views2, create a new view of type node.
add a Filter for Node: Type = Song
add an Argument for Content: Artist = field_song_to_artist
choose "provide default argument"
choose "node ID from URL" (in views i have to click in some whitespace before this option list will appear)
optionally, add Fields for the different parts of the Songs you want to display in this view (such as Title, Body, Whatever, etc.)

basically what this does is says "only show Songs" (filter) and then only show nodes which point to the currently displayed Artist with their field field_song_to_artist. if you don't want to "provide default argument, node ID from URL" (this means... send the view the node of the artist you're currently loading in the URL, so, where this view is being seen on an Artist page at any particular time) you could try some custom PHP to pull various Artist values or specify certain Artist nodes by node id #, but that's kind of beyond me - i've only ever seen the need for default argument, node ID from URL for my lyrics-ish site.

i hope this helps! if you have any other questions or need clarification please let me know.

#2

p.s. if this view has a block display you only wish to appear on nodes of type "artist", you might find the following useful as a snippet of PHP to place in your block's visibility settings (display if following PHP is true):

<?php
$match
= FALSE;
$types = array('artist' => 1);
if (
arg(0) == 'node' && is_numeric(arg(1))) {
 
$nid = arg(1);
 
$node = node_load(array('nid' => $nid));
 
$type = $node->type;
  if (isset(
$types[$type])) {
   
$match = TRUE;
  }
}
return
$match;
?>

#3

wrb, thanks so much for all the help (very good explanations, too).

#4

Status:active» closed (fixed)

no problem! ill close this issue and paste my response on that other thread in the forums.

#5

It helped me too!

Thanks wrb123 for your answer and Chris for your question.

nobody click here