4

In drupal 6 you can create templates to control how node reference fields are output on a content type basis using the suggestion below:

node-nodereference-exampletype.tpl.php

and then output a node reference field that references 'exampletype' nodes in a node template like so:

$node->examplenodereference[0]['view'];

The file naming conventions and output syntax have changed in drupal 7.

Working off the information at this link http://drupal.org/node/998848 I have tried template suggestions like these with no luck:

node--nodereference--exampletype.tpl.php
node-nodereference--exampletype.tpl.php
node--nodereference-exampletype.tpl.php
node-node-reference-exampletype.tpt.php
and so on...

I have tried adjusting the display mode for the field from teaser to full content etc.

I have tried outputting the field with:

print render($content['field_example']);

and

print $field_screening_movie_title;

and variations on the above.

What is the correct way to name a node reference template file in drupal 7? Do I need to use the render function to output a node reference field using the template?

Thanks

1

This module has one display formatter named Rendered node, in its setting you can select view mode which referenced node will render in that view mode.

so you can define new view mode and configure referenced node in that view mode

have a look at this post: http://mearra.com/blogs/juha-niemi/drupal-7-custom-node-view-modes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.