12
Drupal 6 Theme Functions by Blake Lucchesi 1

Drupal 6 Theme Functions

Embed Size (px)

DESCRIPTION

Drupal Camp LA 2008 Presentation on Drupal 6 Theme functions.

Citation preview

Page 1: Drupal 6 Theme Functions

Drupal 6 Theme Functionsby Blake Lucchesi

1

Page 2: Drupal 6 Theme Functions

Tools

Drupal 6.x Installation

Firefox

Firebug extension for Firefox

Devel Module

Text Editor

Other Modules: admin_menu

2

Page 3: Drupal 6 Theme Functions

Theme Functions?

Functions that are declared as theme functions allow the Drupal theme to alter output before presentation.

Modules can provide a default output style and allow advanced theme builders to CLEANLY and EASILY modify their output.

3

Page 4: Drupal 6 Theme Functions

4

Page 5: Drupal 6 Theme Functions

5

Page 6: Drupal 6 Theme Functions

6

Page 7: Drupal 6 Theme Functions

Theme Developer Module

7

Page 8: Drupal 6 Theme Functions

Template Files vs Functions

Template Files (*.tpl.php) Functions

Output is printed<?php print $variable; ?>

Build a single output variable and return it.

$output .= “output”;

Easier to use if mixing a lot of plain html.

Easier to use if using control structures and loops.

The choice is up to you.

8

Page 9: Drupal 6 Theme Functions

Template Files

In D 6.x you can create a template file for ANY theming hook.

Automatically recognized after theme cache is cleared.

Example...

*Note the underscore being changed into a hyphen.

9

Page 10: Drupal 6 Theme Functions

Functions

Template.php is where the party is at!

Overridden functions are placed in template.php.

Keep this file organized with comments.

If it gets too big you CAN use php’s include function to include other files.

Example...

10

Page 12: Drupal 6 Theme Functions

Thank You

Thank you for joining me at DrupalCampLA!

12