Hello,
A quite straightforward question for which I fail to find the answer…

I have some cck fields and using content template I try to make a custom view. How could I show the label of a custom CCK field. For example I have a field with label Model , with name field_model and it is a text. How can I show the “Model”? I am able to show field_model but not the label name which is quite weird…

Thanks in advance!

Comments

ktleow’s picture

Have you tried this?

<?php print $node->content['field_model']['field']['#title'] ?>

or you can simply use <?php print_r($node); ?>

dtsio’s picture

The first one does not seem to give any output (just nothing) and the second one gives me lots of output with not the correct data - it starts like that: stdClass Object ( [nid] => 12 [type] => product [language] => en [uid] => 1 [status] => 1 [created] => 1259796479 [changed] => 1259796479 [comment] => 0 [promote] => 1 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 12 [revision_uid] => 1 [title] => Test2 Product [body] =>

I tried to find some help in this article also (http://drupal.org/node/266817) but no luck so far :(

ktleow’s picture

Hmm, i just tried the same thing I told you, it works on my local machine, it does prints the label for the cck field.

A little searching found this http://drupal.org/node/209229#comment-2308330

Check whether you did it correctly?

dtsio’s picture

Ok i found the solution. I forgot to mention that the fields were grouped. Also I could not see all the variables so i increased the Max recursion depth at admin/settings/contemplate

Adding this code did the work - print $node->content['group_specifications']['group']['field_model']['field']['#title']

Thanks a lot for your help!

ktleow’s picture

Great :)
Glad you managed to found your way through.