Render a CCK field

/ Published in: PHP
Save to your folder(s)

The correct and reliable way to render a CCK field.

Variables used:

* $field_name: the name of the field to render
* $node: a node object
* $teaser: TRUE if being rendered for a teaser
* $page: TRUE if being rendered for a page

Copy this code and paste it in your HTML
  1. // get the field
  2. $field = content_fields($field_name);
  4. // render the field
  5. content_view_field($field, $node, $teaser, $page);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.