Drupal - How do I print the body of a node?
For Drupal 7, a better style is to use field_get_items. E.g.:
<?php
$body = field_get_items('node',$node, 'body');
print $body[0]['value'];
?>
Just try this for Drupal 7
<?php print render($content['body'])?>
If $node
is a node object obtained for example with node_load()
, in Drupal 7 this is the structure of $node->body
.
The language set for the node I used in the screenshot is English, and the input format is full HTML. As far as I can see, the content of the body is always contained in the "und" index, whatever language has been set for the node.
In Drupal 6, $node->body
is a string.
If you implemented hook_nodeapi('view')
(Drupal 6) or hook_node_view()
(Drupal 7) the content of the body is found, respectively, with $node->content['body']['#value']
, and $node->content['body'][0]['#markup']
.