drupal 6 theming

21
Drupal 6 Theming What’s new and how it’s better

Upload: merlinofchaos

Post on 15-Dec-2014

40.112 views

Category:

Technology


2 download

DESCRIPTION

An overview of the changes to theming in Drupal 6.

TRANSCRIPT

Page 1: Drupal 6 Theming

Drupal 6 Theming

What’s new and how it’s better

Page 2: Drupal 6 Theming

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.

Page 3: Drupal 6 Theming

Drupal 4.5: Theming Hell

Only had .theme files and theme function overrides.

Page 4: Drupal 6 Theming

Drupal 4.6: Theming Purgatory

Xtemplate just didn’t do it for us.

Page 5: Drupal 6 Theming

Drupal 4.7: Theming Limbo

PHPtemplate helped, but having only page, node, block, and comment templates is weak.

Page 6: Drupal 6 Theming

Drupal 5: Still Theming Limbo

I guess it’s not really limbo if you’re not stuck there for awhile.

Page 7: Drupal 6 Theming

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.

Page 8: Drupal 6 Theming

Info files

Page 9: Drupal 6 Theming

More templates

• More granular control over your content.

• Logic is separated from presentation.

• Data has already been sanitized meaning fewer inadvertent security holes.

Page 10: Drupal 6 Theming

forum-topic-list.tpl.php

Page 11: Drupal 6 Theming

forum-topic-list.tpl.php

Page 12: Drupal 6 Theming

Logic

Page 13: Drupal 6 Theming

aggregator-item.tpl.php

Page 14: Drupal 6 Theming

Separation

Page 15: Drupal 6 Theming

phptemplate_variables()

Page 16: Drupal 6 Theming

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

Page 17: Drupal 6 Theming

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

Page 18: Drupal 6 Theming

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

Page 19: Drupal 6 Theming

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

Page 20: Drupal 6 Theming

We are merely Enlightened

Maybe Nirvana in Drupal 7

Page 21: Drupal 6 Theming

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