print_r($node) not working as expected on cck fields

Posts: 10
Joined: 10/24/2007

I have created a custom product class and built some cck fields into it.

Normally, calling print_r($node) shows me all the fields for a node as arrays in objects, ie

$node->field_name[0]['value_name']

In this case, I only see the values for my cck fields in the node->body values.

How can I access the cck fields in my template file?

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

I tested this by adding a CCK text field to my product type and doing a print_r($node) in node-product.tpl.php, and I do see $node->field_testfield showing. So I can display the field contents in the template using $node->field_testfield[0]['view']. (field_testfield *also* shows up under $node->body, which is probably what threw you.)

--

<tr>.

Posts: 10
Joined: 10/24/2007

It seems to be the case - once I saw the submit button in the body, I stopped scrolling down Smiling

Thanks!