Reply to comment
Adding a See Also to a content type
Submitted by matt on Sun, 08/02/2009 - 11:19While taxonomy and views can be used prived a list of related entries, it lacks the ability for the author to select individual related entries. Such as writing a short series over time and wanting each in the series to display links to the others.
For this purpose I added a new field Node reference to allow the author to add as many references to existing nodes as needed.

Now we need to edit the node-type.tpl.php to see if there are any see also links and display them.
I have placed this within the content div as I want this area to float to the left of the entry it is in.
<?php
// we only want this to appear within the full page view
if ($page != 0){
$see_also_count = count($node->field_see_also); //Drupal seems to return a count of 1 even when there are 0
if ($see_also_count>0 && strlen($node->field_see_also[0]['view'])>0){
print '<div class="seealso"><h3>See Also</h3><ul>';
foreach ($node->field_see_also as $see_also){
echo '<li>' . $see_also['view'] . '</li>';
}
print '</ul></div>';
}
}
?>
Then adding the style for this div to my css
div.seealso{
width:200px;
float:right;
border:1px solid #999;
padding:3px;
margin:3px;
}

