Hello all,

Here's a real newbie question.

What's the difference between the page.tpl.php and the node.tpl.php?

Of course I can see obvious differences in the code, but what are they used for?
I recently created my first custom node.tpl.php where I changed it to node-custom.tpl.php. This I used to display a custom content type I'd created. But could I have used the page.tpl.php to display the custom content type? Not sure when one or the other should be used.

Thanks in advance

Comments

yelvington’s picture

In the documentation. http://drupal.org/node/171194

lloowen’s picture

Very good book, I'll be referring to it more often in the future. Though I am still unclear as to when one should use a node.tpl.php or a page.tpl.php and how they differ.

Thanks anyway

soulston’s picture

I would think of the page.tpl.php as holding your main css sections, like a wireframe holding the nodes, blocks and other regions. The page.tpl.php also does a few other things like call the css files, primary links and secondary links etc.

The node.tpl.php lets you have finer control of different node types. If you just create a node.tpl.php then it will effect all node types.

Drupal installs with two node types, page and story.

By creating a node-page.tpl.php and node-story.tpl.php you can have a lot more control. At first when you are just outputting the full node it seems a little trivial but when you start to get more involved you see the need for them.

The best way to learn is just experimentation.