I've included a CCK node at the top of my front page, above the listing of the latest nodes. To do so, I've put the following lines in page-front.tpl.php:
$nid = db_result(db_query("SELECT MAX(nid) FROM node WHERE type = 'fp_selection'"));
$node = node_load($nid);
print theme('node', $node);
print $content;
This works fine, *except* that the node contains some node references, output in the node-fp_selection.tpl.php file (that is the template for this content type, since it's called 'fp_selection') with the line print $node_reference1[0][view]; . This works fine when the node is viewed directly, but when included in the front page as above it's empty. By including print_r($node_reference1) in the template I can see that when the node is viewed directly $node_reference1[0] contains [nid] and [view], but when included in my front page it contains only [nid]. How can I get around this - how can I access the view of the node reference when loading the node manually rather than on the node page itself?
Many thanks for any help,
Thomas
Comments
Comment #1
markus_petrux commentedTry using node_view() instead of theme('node').
Comment #2
Tom Ash commentedThanks, that works!