This is a step by step instruction with code on how to theme your Drupal node-custom.tpl.php files. Theming a Node in Drupal is the number one way to set your Drupal site apart.
If you understand basic HTML, CSS, and PHP then you are already most of the way there, if not, then try to follow what I'm going to say.
I first stumbled across an amazing piece of code by watching a podcast from Mustardseed Media Inc. I'm going to just expand on what he said and go into a little more detail here and there. I would recommend watching a few more of his podcasts as he does a really good job showing you how to do basic Drupal things.
First make a dummy node entry for the type that you will be modifying, we will use it later.
Then make a new node template for the node you are trying to custom theme. This is done in two ways:
Once you have your new file made, put this piece of code at the bottom or if you started new then simply paste this code into your node-custom.tpl.php:
<?php print_r($node) ?>
Either just save your file or upload it to your ftp, depending on how you are working on your site.
Refresh your browser on the dummy node entry you made earlier. Notice now that after your content a bunch of other stuff now shows up. That is what we will be referencing later.
To use the code that is displayed on your node entry properly you must understand what it is doing.
These are php functions that we will call to our template and then manipulate to our hearts desire. Lets take a simple piece to start out with. I've set up a demo node with a node-demo.tpl.php you can find HERE. In the node-demo.tpl.php file, all I have printed is
<?php print_r($node) ?>
The text in the [brackets] are the functions that we are going to be using.
Starting off with something simple:
<?php print $node->content ?>
I want you to notice a few things here all the php coding we will be doing will all include:
<?php print ?>
We are simply printing the desired functions. The next part $node is referencing that we are working with a node type. and finally notice that the first level of the function isn't in [brackets]. If you use the rest of the function they will need to be enclosed in [brackets] like this:
<?php print $node->content ['body']['#value']?>
Make sure you use 'apostrophes' around the text in the [brackets], unless it is a number.
To print the content that you want. First, find the field that you want and then find the appropriate children or layers below that field until you get to the actual text, image, or other content. For example if you look again at the demo page HERE.
If I wanted to print the custom cck text field I made for the node. I first find the [field_custom], that is the machine readable name I made when setting up the cck field for the node. Note that there are actually two of these, you want to find the one that is not under the [content]. Then I find either the array above the final function or the final function itself. In this case I find the array . Then I find the final function [value].
Now you put the php code together like this:
<?php print $node->field_custom['value'] ?>
Now that you can print the functions you want, you can simply re-order them to suite your needs or change the css to fit your needs.
You can customize the style.css file also found in your theme's folder.
If you want a 1px black solid border around your content you make a new id in your style.css that looks something like this:
border: 1px solid #000;
And then on your node-custom.tpl.php put this:
anything you want in this div goes here
Update your online or offline files and see the change. *Make sure to clear your cache if you don't see any changes (thanks Robert Dickert)
These are the basics for customizing a node from the php to the css. With this knowledge go out and make great sites that look great, function better, and fit you specific needs not the default needs of all Drupal sites.
*Update for Drupal 7 -
Quote from Robert Dickert in the comment section comment section
"If you are using Drupal 7, you now need to name your file node--custom.tpl.php instead of node-custom.tpl.php (look carefully: there are 2 dashes instead of one)." Thanks Robert! I was getting around to updating this eventually