Your SlideShare is downloading. ×
Introduction to Theme Preprocess Functions
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Introduction to Theme Preprocess Functions

2,006
views

Published on

Published in: Technology, Business

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,006
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Introduction to Theme Preprocess Functions BADCamp 18 Oct 2009 Carl Wiedemann drupal.org user c4rl
  • 2. Preprocess in Theory
  • 3. Theme Dilemmas
  • 4. <div class="content"> <?php print $content; ?> </div> What do we do if this is insufficient?
  • 5. <div class="content"> <?php print $my_content; ?> </div> How can we create more useful theme content?
  • 6. <div class="<?php print $my_classes; ?>"> <?php print $my_content; ?> </div> How can we create more useful theme content? How can we keep our theme contextual?
  • 7. Preprocess
  • 8. <?php print $my_content; ?> Preprocess makes content flexible
  • 9. class="<?php print $my_classes; ?>" Preprocess makes theming dynamic
  • 10. if else foreach while switch = Preprocess keeps templates clean
  • 11. So, when does preprocess happen?
  • 12. Request Processing
  • 13. Database Raw Data Modules Request Processing Return Data
  • 14. Database Raw Data Modules Request Processing Return Data Theme Formatted Data HTML!
  • 15. Database Raw Data Modules Request Processing Return Data Theme Formatted Data HTML!
  • 16. Preprocess in Practice
  • 17. Firebug Web Developer Toolbar admin_menu devel devel_themer
  • 18. Exploring template.php mytheme_preprocess_page dsm mytheme_preprocess_node theme.inc Demo
  • 19. Manually creating $myvar $submitted Demo
  • 20. Specifying additional templates Demo
  • 21. Contextual CSS Demo
  • 22. Working with CCK $content Demo
  • 23. Important things to remember: dsm() delays on preprocess_page() Clear cache when adding new tpl files and adding functions to template.php Use check_markup() and check_plain() on data that may be unsafe
  • 24. Questions and Thanks Thanks to Matt Tucker (ultimateboy) for inspiring this talk Demo Photography Credits “Black cat” http://www.flickr.com/photos/revilla/529107119/ “Baseballs” http://www.flickr.com/photos/randomacts/2277808469/ “Basketball” http://www.flickr.com/photos/chillihead/3150447792/ “UNF Baseball vs. Florida Gulf Coast University” http://www.flickr.com/photos/8363028@N08/3368813471/ Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License http://creativecommons.org/licenses/by-nc-sa/3.0/us/