I want create a custom template node-mytype.tpl.php for my added custom content type mytype.
(Drupal 5.0, CCK 5.x-1.2, content template 5.x-1.1)
This type has body field enabled.
I have no problem to read $title, $field_cckfieldname[0], ... and theme these individual fields.
Variable $body consists all fields values, but I would like to display only value of the "body field".
Is there any variable which contains only the field body value, like $field_body?

It is my first try with CCK, I did not find any solution on this web.
It does not make any sense to me to theme individual cck fields, title, ... without possibility to theme one body field.
I hope that I only overlooked some variable or is it my misunderstanding of the cck theming concept?

I have checked briefly content templates without success too.
Is there any way how to "template" value of the $body variable content?

Thanks for help

Comments

maureen’s picture

I too am having this problem and would appreciate help from anyone.

hatsch’s picture

i have the same problem $body shows a list of all fields, and i only wont the body field at output, because i am placing the other fields seperate . . .

any ideas?

mlncn’s picture

There are a bunch of variations thatt I think ought to work but only that one does: print $node->content['body']['#value'];.

On Agaric Design's site I've written more about theming whole CCK nodes, with some updates for Drupal 5.

~ben

People Who Give a Damn :: http://pwgd.org/ :: Building the infrastructure of a network for everyone
Agaric Design Collective :: http://AgaricDesign.com/ :: Open Source Web Development

benjamin, Agaric

As If’s picture

Benjamin's approach worked for me on one site, but not on another. I ran around in a circle for a while trying all the variations too. If I ran a print_r($node) I could see the $body just fine, but whenever I tried a variable to get it into the template it printed the entire node (or nothing at all). Then just for the hell of it I tried echo $node->content['body']['#value'][0] and I saw a < sitting there on the page. Curious, I then tried echo $node->content['body']['#value'][1] and I got a !. And echo $node->content['body']['#value'][2] gave me a -

I realized I was looking at an HTML comment.

Where was it coming from? Google AdSense Injector.

I went to the AdSense Injector settings page and disabled "Insert inline ad in node body on page views".

My $body content came back, and Benjamin's approach worked again.

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

joeking1’s picture

i am faceting the same problem, i tryed $node->content['body']['#value'], it returned blank, so weird....
i placed an exit after it, it worked! quite confusing, it printed the text of the body when i put an exit in the end...
any idea?

abu3abdalla’s picture

thank u

joeking1’s picture

i am faceting the same problem, i tryed $node->content['body']['#value'], it returned blank, so weird....
i placed an exit after it, it worked! quite confusing, it printed the text of the body when i put an exit in the end...
any idea?