I've added fields to a content type (Page) using CCK.
Having read the CCK theming manual, I created a new document called node-Page.tpl.php.
This theme is being called and there is no issue from that perspective.

What I am having trouble with is calling the default (pre-defined) label "Body" with name "Node module form".

When you go to create content for Page you see "Title", "Body", and my added fields.
I can easily call Title using $title and the CCK fields using content_format('field_example', $field_example) but calling $body calls Body + CCK fields.

Is there same way to call just the Body field?

Comments

medenfield’s picture

Try print $node->body

To see other suggestions, paste this into your tpl.php :

drupal_set_message('<pre>'. print_r($node, true) .'</pre>');

Also, check out the contemplate module. It's good at templating suggestions for node theming. Or just use the drupal_set_message. Hope this helps.

madamimadam’s picture

>Try print $node->body

Unfortunately, this is the same as $body

>drupal_set_message('

'. print_r($node, true) .'

');

This actually doesn't do anything for me :(

medenfield’s picture

hmmm....Take a look at contemplate if you haven't already. I think you'll like what you see.

http://drupal.org/project/contemplate

madamimadam’s picture

In case anyone else has the issue, in my Page.tpl.php file I replaced

print $content;

with

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

In the content type edit form, there's a 'Display fields' tab with an 'Exclude' checkbox that allows you exclude a field from $content.

zanlus’s picture

I was having the same problem. Took me a while to work that out today. But, now I'm struggling to import the image that is part of the node. Any ideas on the necessary calls to pull in image content. I can get it to show as a link to the image, but not the image itself.

Thanks!

hobbes_VT’s picture

The solution with the page template and loading the original body content worked.
However, I had the same issue again when working with views, where I don't have access to the full node variables in my theming templates.
What worked for me was setting the CCK fields to "HIDDEN" (in the content type settings) and add the CCK variables after the node:Body field in the view listings. Now I have complete control over all my variables in the view theming templates.

Cheers,
Georg