pre process functions in template.php

18
Pre-Process Functions in Template.php June 22, 2012

Upload: green-for-all

Post on 28-Jan-2015

104 views

Category:

Software


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Pre process functions in template.php

Pre-Process Functions in Template.php

June 22, 2012

Page 2: Pre process functions in template.php

Harris RashidThemer & Developer

@[email protected]

Page 3: Pre process functions in template.php

Theme Structure

Page 4: Pre process functions in template.php

What is it & when does it happen?

Pre-Process

Page 5: Pre process functions in template.php

Processingweb request

Page 6: Pre process functions in template.php

Processingweb request

Raw Data (from DB)

Return Data (modules)

Page 7: Pre process functions in template.php

Processingweb request

Raw Data (from DB)

Return Data (modules)

Formatted Data (themes)

HTML

Page 8: Pre process functions in template.php

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

Page 9: Pre process functions in template.php

Tools

- Devel module- Admin menu module- Firebug firefox plugin

Page 10: Pre process functions in template.php

Floated Right

Page 11: Pre process functions in template.php

Floated Left

Page 12: Pre process functions in template.php

Tools

yourtheme_preprocess_node($variables)

Page 13: Pre process functions in template.php

Variables

Drupal 7: $variables

Drupal 6: $vars

Page 14: Pre process functions in template.php

How do I use preprocess with Fields?

- Image (file)

- Image Caption (image description)

- Image Alignment (text - radio buttons)

Page 15: Pre process functions in template.php

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

Page 16: Pre process functions in template.php

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

Page 17: Pre process functions in template.php

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

Page 18: Pre process functions in template.php

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.