Something that has been bothering me since I started using drupal is how exactly does the php engine know which $node/$classes/$attributes you are referring to in template files. these variables are never declared as globals, so how does the php engine figure out what “$node” you are referring to??
Share
See http://drupal.org/node/223430 which states
Look at the
template_preprocess*and thetemplate_processreferred to in the API. These functions show you the code that set up the various variables that you can access in your node template.In a similar manner, you can also add your own preprocess code in a theme function to add to the variables available in your tpl.php file like so:
After this, you can reference
$helloin yournode.tpl.phpfile.