Objective: To be able to select cck fields and style and position them for a content type.

1)

I have created a content type for marine species, within which there are a number of different fields, for example [field_top_25] [field_abundance] [field_size].

2)

I then created a new custom node so that i can theme that content page type, i have checked that drupal is picking up this new node, which it is.

3)

Using print_r($node) I can see a vast range of variables on my node page, from which i assume I pick the [field_top_25] [field_abundance] etc and then place them within their own css tags to style?.

But what do i have to write in the code to make them display? - I'v tried print $fields['field_top_25']->content; which doesnt work?

Any solutions would be welcome!

Thanks in advance

Comments

nevets’s picture

Try looking at

print_r($node->content);

and/or

print_r($node->content['field_top_25']);

(There is not $fields variable in node.tpl.php)

vonny007’s picture

print_r($node->content['field_top_25']); looks like what i need.

Cheers

intrafusion’s picture

You can also use:

//Raw field
$node->field_top_25[0]['value'];

//Semi-styled
$node->field_top_25[0]['view'];
agogo’s picture

..this if you have trouble with say Image Assist

<?php $node->field_top_25[0]['safe']; ?>