is it possible to print the NODE BODY only?

as in no title, no image or CCK fields?

i'm using drupal 5.x and i've tried the following:

echo $node->body;

but this currently prints the body and all the cck field's

Comments

mz906’s picture

nevermind fonud it on another site, solution:

print $node->content['body']['#value'];
NickWebman’s picture

This helped me. Thanks.

titi88888888’s picture

Thanks, this helped me too !

drupalfever’s picture

I actually wanted to print the body of a node by providing the node ID. Here is what I came up with:

<?php

$node_id = 5; //It can be any Node ID. I used Node ID = 5 just as an example.
$node = node_load($node_id); //Load the node object.
node_view($node); //Get the node array into memory.
$node_content = $node->content['body']['#value']; //Now you can parse only the body value into a variable.
echo $node_content; //Printing content.

?>

It took me a while to put together these few lines of code. I hope that this will save someone else’s a little time down the road.

itserich’s picture

Thanks.

I was able to use the original code to populate a cck field with the body of a node in a Rules Action.

<?php 
echo $node->body; 
?>

Very new to php.

numerabilis’s picture

How to put that in practice?

how can I run this code in a onclick button event using javascript? print $node->content['body']['#value'];