drupal theming

Anatomy of a Drupal Theme - Basic Structure

It can be a bit confusing to create a custom theme for Drupal. Users new to this process typically hack a core theme like Garland, or grab a starting theme from the repository, but then it's easy to get frustrated with all the different template files, functions, and styles. After all, what are these extra functions? Why aren't they included in Drupal's core if they're so necessary? Why do I see page.tpl.php and a bunch of node-*.tpl.php files and a dozen other .php and misc files? I'll try to cover some of the basic concepts of Drupal theming and get into the more advanced stuff in later posts. My goal here is to really break things down on a simple, linear level.

Anatomy of a Drupal Theme - The Node Object

The function behind the $node object is node_load(). This brings the $node object into play within your node.tpl.php template file and gives you the ability to display any variables from the node. Drupal handles everything behind the scenes -- access permissions, attached taxonomy, attached files, meta information, and more -- and hands you the gift wrapped object. In addition to the core variables, the node object also includes any added variables, such as CCK fields. 

Subscribe to RSS - drupal theming