You are here

Theming CCK fields in Drupal 7

Drupal node display can be overridden using a template file of the form:

  • node--content_name.tpl.php

The simplest way of displaying fields is to use the render() function

The render array is documented here: drupal.org/node/930760

  • Individual field values can be found in one of:
    • render($content['field_name'] fully rendered value
    • $content['field_name']['#items']['0']['safe_value'] will include paragraph markup
    • $content['field_name']['#items']['0']['value'] raw
    • $content['field_name'][und']['0']['safe_value'] will include paragraph markup
    • $content['field_name']['und']['0']['value'] raw
    • $content['field_name']['0']['#markup'] formatted, but in a select list will show the raw value
Topic: