Skype: theneemtreegroup
Phone: (Australian callers) 02-8003-4624
(international callers) +61-2-8003-4624
Email: http://neemtree.com.au/contact
Drupal theming for designers, continued.
Drupal Theming – Part 2 – Controlling themes
This is a continuation of the earlier article on Drupal theming for designers.
Near the end of the previous article, we mentioned other *.tpl.php files used by themes. These files, and any others that you create, using Drupal’s PHPTemplate file naming convention, you are able to ‘override’ the default display:
- node.tpl.php
- block.tpl.php
- box.tpl.php
- comment.tpl.php
Drupal’s PHPTemplate theme engine uses the content generated by these files in page.tpl.php, as the following diagram demonstrates:
More control means more power
Using the *.tpl.php you can control:
- the display of different content types, such as blogs, forum posts, or anything else you create.
What are 'content types' (node-[content type].tpl.php) - the display of content in edit-mode (node-edit.tpl.php)
- the display of individual nodes
What is a 'node' (node-[node ID number].tpl.php) - the display of the front page

Controlling the content being passed to the *.tpl.php using variables
Let’s look at the variables used in page.tpl.php and node.tpl.php:

Here, we see page.tpl.php prints variables such as $sidebar_left and $mission.

In node.tpl.php we see variables such as $sticky.
You can use template.php to override functions returning these variables and you can intercept other variables:

This template.php example, from the Zen theme, demonstrates function overrides:
- zen_regions
- zen_breadcrumb
Here is the documentation listing all themable functions: http://api.drupal.org/api/group/themeable/5
A brief note regarding regions
It also demonstrates variable re-definition, which is scope controlled:
- $vars[variablename]
Here is documentation listing all variables available in page.tpl.php, node.tpl.php, and block.tpl.php.



















Comments
As great as part 1. This is the most useful tutorial for the beginners to design their own themes.
software reviews
Can these themes be implemented on something else and not a Drupal template?
---
link building company
The correct link for the apress pdf file to download is: http://apress.com/resource/bookfile/3486
that should correct any link problems.
I had no idea that Drupal themes are created using PHP now. How do they fit with older ones that are not using this programming language? I tried combining pHp with my old code on offshore corporation but nothing really changed.
Post new comment