This site is archived.

Theme Preprocess Functions: an Introduction

Day: 
Monday
Time: 
11:00 AM - 12:00 PM
Room: 
304 Phase2 Technology

Presented by

Carl Wiedemann (c4rl)
Growing Venture Solutions
Design, Theme, and UsabilityDesign, Theme, and Usability
Style & substance: Learn about trends, techniques, and tools.

How many times has this happened to you: You're theming a Drupal site, writing your CSS and making a few changes to the tpl files here and there. Everything is going great, then suddenly you realize you need to change one of those things that starts with a "$" inside those funny-looking <?php ?> tags. Panic!

You exclaim...

"Crap! Where does <?php print $content; ?> come from?! How do I change it?!"

or maybe...

"Crap! I need to have an extra CSS class on this body tag that depends on the taxonomy of the node on the page! Is that possible?!"

or perhaps even...

"Crap! This view is perfect, and it even says which posts are unread, but I need to have the background color for unread item to be different! How can I get that working?!"

Sound familiar?

Preprocess functions are the diplomats of Drupal themes. They are the missing link between what happens in the modules, and what gets sent to the template files.

In this session, we'll dispel PHP fears, and get our feet wet with a little code that goes a long way to helping out with improving the flexibility of our theme.

Prerequisites: Some experience with Drupal theming, general understanding of the templating system, good understanding of HTML and CSS, some basic familiarity with PHP.

Experience: Intermediate, Advanced, Expert
Industry: education, entertainment, library, marketing, media, non-profit
Tags: preprocess, theming