theming tips and tricks

Download Theming tips and tricks

If you can't read please download the document

Upload: aaroncouch

Post on 16-Apr-2017

2.852 views

Category:

Documents


0 download

TRANSCRIPT

Theming Tips and Tricks

DrupalCamp Wisconsin July 23rd 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!

Templates

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

Theme Functions

Five times faster than templates!

For themers, place in template.php

Preprocess Functions

Add or overwrite variables to template files

Often used in template.php

themename_preprocess_page can be used for page.tpl.php

Module Hooks

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 arelooking 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

Theme Functions

Overwrite 'submitted by'

theme_node_submitted($node)

Theme Functions

theme_links() overwrite output of primary menu

Theme Functions

theme_imagecache()add description to images!

Preprocces!

Update comment time

Make title different colors

Add a 'Add your photo' Button

Module Hooks

Edit search form

Message to administrators

Adding your own theme functions and templates

Useful theming modules

Nice menus Quick tabs Skinr

Theming Tips and Tricks Wisconsin Drupal Camp - 7/23/10