Search code examples
phpdrupaldrupal-7field

How print field of another node


I know, that I can print a field from current node in template by e.g.

<?php print render($field['title_field']); ?>

but how I can print another nodes field?


Solution

  • First get that node id somehow, then load whole node:

    $node = node_load($nid);
    

    Inside that $node object you'll have your field value. print_r or var_dump $node to see exact structure and how to approach your field value.