Drupal Theming 101

(Update: This is the last in a series (except for the summary) of live posts from DrupalCampWisconsin, with a little cleanup and added links.)

Blake Hall presents.

The professor ran late, so no break between 100 and 101. Blake made this presentation to the Madison PHP Meetup a few days ago. Also stolen from Pro Drupal Development.

Three Theme Engines in Drupal: PHPTal, Smarty (CiviCRM), TPL (Core)+Template.php

Blake is porting a WordPress theme into Drupal. See blakehall.org for what’s “nearly there.”

Every time I hear Blake give a presentation, he always says “the next version is way better.” So it is with Drupal v6, especially in theming.

Larry Garfield picks up with “what’s new in v6.”

Aim: Theming Nirvana. Not there yet.

v4.5: Theming Hell
v4.6: Purgatory, aka Xtemplate
v4.7: Limbo, aka PHPtemplate. Page, node, block and comment templates. Currently the dominant engine.
v5.0: No changes
v6: Pure CSS themes, drive toward separating out presentation. Info files create themes.

Displays the structure of Info files: Stylesheets, scripts, regions, features.

More granular control over content. Data sanitized; fewer inadvertent security holes.

Some code comparisons. Way better.

v6 offers theme inheritance. Set base theme, make whatever changes you want. Use well-named classes to identify areas (though not yet complete).

Template engine is now just a set of tags.

Time to show some code! (Writes 4 lines into demo.info) This is a naked Drupal. No Divs, no Tables, a semantic page. Adds another line: base theme = garland. Looks like Garland (standard theme).

Adds another line to reference a stylesheet. To override an existing stylesheet, reference the same name as the existing stylesheet in the Info file.

Default node template: node.tpl.php. Copy file into your site and modify (un-comment) as you wish.

Cool stuff!

There is one more session scheduled, but this reporter’s brain is getting full. I believe I’m going to call it a day, blogging-wise. I’ve got some summary ideas, which I’ll share when I get refreshed. I’ll also add links and otherwise make pretty. Thanks for reading along. Please comment as the spirit moves.

Powered by ScribeFire.

Advertisements

2 thoughts on “Drupal Theming 101

  1. Not in a position to judge myself, but I heard quite a few Wows in the crowd. It certainly seems like the new Info files in Drupal 6 will make theming much, much easier.

Comments are closed.