1

If I have a custom CCK field, for example "temperature", is there any way I can directly call it from the node template? Like would there be a $temperature variable?

Thanks!

4

You can access it directly from the node variable like: $node->field_temperature[0]['view'].

If you want to see what values are actually on the node, I'd suggest var_dump($node); in the template to check out what fields/values you can access.

  • so using that, I could output it in the node, right? Thank you! – Jane Jun 8 '11 at 17:22
  • yeah, so for example if you created a template in your theme for the node, like "node-thermometer.tpl.php" for a content type of thermometer, you would be able to use that to output the temperature on the thermometer. – hross Jun 8 '11 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.