Book Image

Drupal Multimedia

Book Image

Drupal Multimedia

Overview of this book

Table of Contents (16 chapters)

Overriding Image Nodes


Often, we need to re-theme a page or section of a page. Sometimes we can use existing classes and markup, and simply make changes to our stylesheet to accomplish this as with the previous examples. At other times, however, the markup is not exactly as we need it. So we need to override Drupal's output directly.

To this end, we can override any theme function that Drupal provides. But before we go into more detail, let's look again at nodes.

When nodes are displayed, PHPTemplate will output its content using specially named template files. Drupal will first look for a file named node-TYPE.tpl.php in the theme directory, where TYPE is the node's type. Failing to find this, it will use the theme's node.tpl.php. Finally, if that file doesn't exist as well then it will use the default node.tpl.php found in the Node module's directory (at /modules/node/node.tpl.php).

As an example, we'll quickly look at image nodes. Let's say that our editor doesn't want image attribution on...