Themeing CCK output in Drupal

There seem to be several ways of getting CCK fields into your node-typename-node.tpl.php file:

  • First using the _rendered variable which will give both the label and the content: <?php print $field_website_rendered; ?>
  • Second using 'view' which will just give the contents of the field:<?php print $field_website[0]['view']; ?>
  • Two methods recommended by Front End Drupal. First using 'safe': <?php print $node->field_website[0]['safe']; ?> seems to fail all the time
  • Second using 'value': <?php print check_markup($node->field_website[0]['value'], 3, TRUE); ?> works if the field has a value, e.g. an integer field.

To get the body field, use:

  • <?php print $node->content['body']['#value'] ?>

When the current node is not loaded, or the field is displayed in views, use: (documented on

  • <?php print content_format('field_name', field_name[0], 'default', $node); ?>

For more information, see:

If it is taxonomy terms that need to be themed, see: