Customising node layouts
Description
This section outlines and provides snippets for customising node layouts.
(If you want to customise the layout of your FULL page, click through to the Customising full page layouts and sections collection of handbook pages and snippets).
Usage
Scroll down for some example snippets, that you can copy-and-paste and use in your custom node.tpl.php or node-type.tpl.php layout files.
It is recommended that you use a text editor like notepad.exe, or equivalent, when editing your layout files.
For PC users, a useful tool for editing a mix of HTML & PHP is Crimson Editor (Freeware).
Available variables
- $title : Title of node.
- $node_url : Link to node.
- $terms : HTML for taxonomy terms.
- $name : Formatted name of author.
- $date : Formatted creation date.
- $sticky : True if the node is sticky on the front page.
- $picture : HTML for user picture, if enabled.
- $content : Node content, teaser if it is a summary.
- $links : Node links.
- $taxonomy (array) : array of HTML links for taxonomy terms.
- $node (object) : The node object.
- $main : True if the node is appearing in a context, like the front page, where only the teaser should be shown.
- $page : True if the node is being displayed by itself as a page.
- $submitted : Translated text, if the node info display is enabled for this node type.

$teaser
in drupal 4.7 here, there's also a $teaser variable indicating whether teaser or full content is displayed.
PAGE: $page == 1, $teaser == 0
TEASER: $page == 0, $teaser == 1
COMMENT_FORM: $page == 0, $teaser == 0
this is helpful if you want for the comment form yet another formatting that for the main page or teaser.