0
votes

I am working on one already created drupal site. In themes folder it has one tpl.php file, Where theme is done to display the content. Now it is as follows

print $content

And all the fields of cck are displayed properly. But I want to access every field like Title, Body etc. I have tried with $content['title'], But nothing is displayed.

Can anyone please tell me how to access different fields in my tpl file. I am using Drupal 6.

Thanks in advance.

2

2 Answers

0
votes

try to

<pre>
 print_r($content);
</pre>

then you will see what's exactly in the array.

0
votes

You can use node-[type].tpl.php to see the different fields. There, by default, each CCK field is exposed in a variable named with the field's name, for example if you have a field called field_logo then you have a variable called $field_logo which is an array representing the field's processed values and can be print_r()'d.

More template suggestions are available in Drupal documentation. And more information on using node.tpl.php and its derivatives is available too.