Drupal template files (*.tpl.php)
Many templates are associated with a core or contributed module, e.g. modules/node/node.tpl.php To override one of these templates, place it in your theme directory and modify (prior to Drupal Version 6 this also required making an entry in template.php). Always be sure to clear the site caches after manipulating a template!
Here are some over-rides often found in template.php: Get rid of orange "Syndicate content" icon (aggregator module) <?php function yourthemename_feed_icon($url) { if ($image = theme('image', 'misc/feed.png', t('Syndicate content'), t('Syndicate content'))) { /*return ''. $image. '';*/ } } ?>
To see template variables:
Install and enable the devel module and put <?php dsm($node); ?> near the top of your template. This will help you understanding the data structures and the variables being passed to your template.
or,
Install and enable the devel module and put: dpm($item); or replace $item with the object in question and then go refresh your page, which should diisplay the details of your objects where the messages go.
Another way to debug variable values is to use:
drupal_set_message('<pre>' . print_r($form, TRUE) . '</pre>');
This will work not only in tempates but in any PHP code where you need to debug code by examining variable and array values.
To create a custom template for a specific content type, name the template: node-contenttype.tpl.php, for example: node-blog.tpl.php for the content type named "blog".
Preprocess functions are used primarily to create variables used by theming hooks implemented as templates. Normal theme functions found in template.php do not interact with preprocessors.