Return to Snippet

Revision: 40116
at January 26, 2011 11:33 by jonathanpglick


Updated Code
// Full render, including value & labels
$node = node_load($nid);
$node = node_build_content($node, FALSE, FALSE);
$rendered_field = drupal_render($node->content['field_name_to_render']);

// Populate the node "view" values as if it was on a node template
// Puts rendered values in $node->{field_name}['view']
$node = node_load($nid);
$node->build_mode = 'full node';
$node = node_build_content($node);
drupal_render($node->content);
content_alter($node);

// Render just a field
$result = content_format({field_name}, $node->{field_name}[0], '{format_name}');
// {format_name} can be found from the output of: 
content_fields('{field_name}', '{node_type_name}');

Revision: 40115
at January 26, 2011 10:51 by jonathanpglick


Initial Code
$node = node_load($nid);
$node = node_build_content($node, FALSE, FALSE);
$rendered_field = drupal_render($node->content['field_name_to_render']);

Initial URL


Initial Description
Render the contents for a single node field.

Initial Title
Render single node field

Initial Tags
drupal

Initial Language
PHP