I've created a custom node type, and I've created a custom template 'node-custom.tpl.php' file. I've been reading about all the default variables that are available for a node template (http://drupal.org/node/11816). Can someone explain how I might go about creating a new variable, that would be available in a node template, to store data from a custom field?

Example (in 'node-custom.tpl.php'):
<div class="customfield"><?php print $customfield ?></div>

Comments

nevets’s picture

If the field is part of your custom content you should be using the load hook to load the custom data/fields into the node so they should be available as part of $node, that is $node->customfield should work.