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!

1 Answer 1

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.

2
  • so using that, I could output it in the node, right? Thank you!
    – Jane
    Commented Jun 8, 2011 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
    Commented Jun 8, 2011 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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