Theming Tips and Tricks DrupalCamp Wisconsin July 23 rd 2010
Ways in Which We Will Override Presentation Templates Theme Functions Preprocess Functions Module Hooks
Templates vs. Theme Functions
Core, modules, and themes output xhtml through templates and functions
You can overwrite this!
Files ending in *.tpl.php
Overwritten by placing file in theme folder
Default templates include page.tpl.php, node.tpl.php, block.tpl.php
Default list: http://drupal.org/node/190815
Five times faster than templates!
For themers, place in template.php
Add or overwrite variables to template files
Often used in template.php
themename_ preprocess_page can be used for page.tpl.php
You can also overwrite output using hooks in modules
“ Business logic” belongs in modules
I'm looking at you hook_form_alter and hook_nodeapi !
Theming Documentation It is excellent: http://drupal.org/node/341628
Theme developer Find what you are looking for!
Add Dimension to Your Blocks = boring = awesome! Add background to block titles Add extra div to block.tpl.php (using zen and only on second sidebar go with block-sidebar_second.tpl.php) see: http://drupal.org/node/104319 Add background image to extra div
Make Your Comments Look un-Drupal
Find a cool looking comments ( http://vandelaydesign.com/blog/galleries/comment-designs/ )
Drop your base theme or core comment.tpl.php in your theme folder
Add some divs, move variables, and give it some css