Drupal 6 Theme Functions
-
Upload
boldsource -
Category
Technology
-
view
3.996 -
download
0
description
Transcript of Drupal 6 Theme Functions
![Page 2: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/4.jpg)
4
![Page 5: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/5.jpg)
5
![Page 6: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/6.jpg)
6
![Page 7: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/7.jpg)
Theme Developer Module
7
![Page 8: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/10.jpg)
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 11: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/11.jpg)
Further Reading...
Online: Drupal API Docs
Online: Drupal Themes 5.x to 6.x (d.o handbook)
Online: Theme Developers Guide (d.o handbook)
Online: Drupal Theming/Sitebuilding Workshop Notes (BoldSource)
Screencast: Theme Developer Module (d.o handbook)
Group: Theme Developers (g.d.o group)
Book: Drupal 6 Themes (Packt)
11
![Page 12: Drupal 6 Theme Functions](https://reader034.fdocuments.us/reader034/viewer/2022052602/559cf5061a28ab94438b468d/html5/thumbnails/12.jpg)
Thank You
Thank you for joining me at DrupalCampLA!
12