pre process functions in template.php

Post on 28-Jan-2015

104 Views

Category:

Software

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Pre-Process Functions in Template.php

June 22, 2012

Harris RashidThemer & Developer

@harriszrashidharris@chapterthree.com

Theme Structure

What is it & when does it happen?

Pre-Process

Processingweb request

Processingweb request

Raw Data (from DB)

Return Data (modules)

Processingweb request

Raw Data (from DB)

Return Data (modules)

Formatted Data (themes)

HTML

$content in node.tpl.php & page.tpl.php

Tools

- Devel module- Admin menu module- Firebug firefox plugin

Floated Right

Floated Left

Tools

yourtheme_preprocess_node($variables)

Variables

Drupal 7: $variables

Drupal 6: $vars

How do I use preprocess with Fields?

- Image (file)

- Image Caption (image description)

- Image Alignment (text - radio buttons)

Create a template.php file, turn on the Devel Module, and use the DSM function.

Refresh your node page twice, and you should see the Kufon display of the node.

We're going to need the following values for field_image, field_image_position

More Resources

http://drupal.org/node/223430

http://api.drupal.org

Pre-Process can be used on Nodes, Pages, Search Results, Views, User Pictures, and a host of other places in Drupal.

top related