Drupal 6 Theme System Architecture Theme Templates Theme

  • Slides: 11
Download presentation

Drupal 6 Theme System • Architecture – Theme Templates – Theme Engines – Theme

Drupal 6 Theme System • Architecture – Theme Templates – Theme Engines – Theme Hooks • What’s New – – Theme registry Theme Inheritance Modules & Themes speak! Discusssion • Tips & Tricks – Discussion

Drupal’s Architecture 3 main elements: • Theme Templates • Theme Engines • Hooks

Drupal’s Architecture 3 main elements: • Theme Templates • Theme Engines • Hooks

Why Theme Templates? • Like most CMS’ templates are used to keep design elements

Why Theme Templates? • Like most CMS’ templates are used to keep design elements separate from processing logic. • Templates allow flexibility to change your current theme without causing problems in other parts of Drupal. • Drupal can be updated without breaking your design / theme.

Theme files When a regular Drupal page is rendered several template files are used:

Theme files When a regular Drupal page is rendered several template files are used: • Page. tpl • Node. tpl • Block. tpl • Comment. tpl • Template. php (customizations) • Etc…

Theme Engines What is a theme engine? • Consists of a set of files

Theme Engines What is a theme engine? • Consists of a set of files that handles rendering data. What theme engines does Drupal support? • Most common: PHPTemplate • Smarty • XTemplates

Theme Hooks Like Drupal modules, Themes also use the hook setup to call functions

Theme Hooks Like Drupal modules, Themes also use the hook setup to call functions and / or theme related files. Here are some things Drupal does with theme hooks: • Registering & handling theme files • Searches and loads specified theme files instead of calling the hook • Modules can use theme hooks to format data.

What’s New – Theme Registry Drupal's theme registry maintains cached data on the available

What’s New – Theme Registry Drupal's theme registry maintains cached data on the available theming hooks and how to handle them. Learn more about theme registry and how to override it: http: //drupal. org/node/223463

What’s New – Theme Inheritance What is Theme Inheritance? • Is where new themes

What’s New – Theme Inheritance What is Theme Inheritance? • Is where new themes can draw assets from other themes, like stylesheets, tpl files, js etc. Theme inheritance allows great flexibility to make your own theme quickly. … Also, great for beginners to learn theme layer.

What’s New – Modules & Themes In the new theme system module files can

What’s New – Modules & Themes In the new theme system module files can create their own template files and push data to them. Benefits? • Can skip doing phptemplate_var() in the template. php file – by pulling tpl files from the module. • Or, skip overriding files and work in the template. php file with the preprocess function. • Preprocess function? Friend or Foe?

Tips & Tricks - Discussion What are some tricks you use often in theme

Tips & Tricks - Discussion What are some tricks you use often in theme layer? What would you like to do in theme layer but do not know how or if it is possible?