drupal 6 theming
DESCRIPTION
An overview of the changes to theming in Drupal 6.TRANSCRIPT
Drupal 6 Theming
What’s new and how it’s better
Are we near Theming Nirvana?
Theming Nirvana is when it is considered easy for designers to create new themes, and there are many themes for random Drupal users to choose from.
Drupal 4.5: Theming Hell
Only had .theme files and theme function overrides.
Drupal 4.6: Theming Purgatory
Xtemplate just didn’t do it for us.
Drupal 4.7: Theming Limbo
PHPtemplate helped, but having only page, node, block, and comment templates is weak.
Drupal 5: Still Theming Limbo
I guess it’s not really limbo if you’re not stuck there for awhile.
Drupal 6
• Info files make obscure configuration obvious• 31 templates available and growing• Serious drive toward separation of logic and
presentation• Better _phptemplate_variables()• Theme inheritance• Pure CSS themes• Theme engines have all this, too.
Info files
More templates
• More granular control over your content.
• Logic is separated from presentation.
• Data has already been sanitized meaning fewer inadvertent security holes.
forum-topic-list.tpl.php
forum-topic-list.tpl.php
Logic
aggregator-item.tpl.php
Separation
phptemplate_variables()
Theme inheritance
• A sub theme sets ‘base theme’ in info file• A sub theme gains all style sheets• A sub theme gains all templates• A sub theme gains all functions in
template.php• A sub theme should never use
phptemplate_* functions• Safest way to ‘tweak’ a theme and still be
able to upgrade the theme
CSS only themes
• Core page.tpl.php theme based on zen
• Uses well-named classes to identify areas
• A theme with just an .info file will create an ugly site but with clean XHTML that can be manipulated
Theme engines
• Smarty, PHPTal, LOLTheme
• Register an extension -- .smarty
• Register a renderer – smarty_template_render()
• Discover templates on behalf of the theme
• Load a template.php file on behalf of the theme
Are we near Theming Nirvana?
• Not everything templatized• Not a complete enough set of well-named
classes• Not enough direction for contrib modules
in how they create their HTML• Not enough direction for contrib theme
authors• Poor infrastructure for finding themes on
drupal.org
We are merely Enlightened
Maybe Nirvana in Drupal 7
Care to contribute?
• Help participate and clean up our XHTML CSS
• Help create a set of well-named classes to use across Drupal
• Help create templates that do not yet exist