63
Drupal front-end Marek Sotak

Atomicant Drupal 6 Theming

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Atomicant Drupal 6 Theming

Drupal front-end

Marek Sotak

Page 2: Atomicant Drupal 6 Theming

Hello

Marek SotakDeveloper, designer

co-founder of atomic ant ltd web design company based in London, Prague and Denmark, operates internationaly.

Creator of RootCandy admin theme

http://drupal.org/project/rootcandy

http://twitter.com/sotak

http://facebook.com/sotak

http://atomicant.co.uk

Page 3: Atomicant Drupal 6 Theming

Theming – Drupal 6

● Theme = presentation layer – separated from logic– No need to touch the modules if we want to change

the output (markup)● PHPTemplate engine (Smarty, xtemplate, etc...)● Saving to sites/*/themes/my-theme

Page 4: Atomicant Drupal 6 Theming
Page 5: Atomicant Drupal 6 Theming
Page 6: Atomicant Drupal 6 Theming
Page 7: Atomicant Drupal 6 Theming
Page 8: Atomicant Drupal 6 Theming

Theme anatomy

Page 9: Atomicant Drupal 6 Theming
Page 10: Atomicant Drupal 6 Theming
Page 11: Atomicant Drupal 6 Theming
Page 12: Atomicant Drupal 6 Theming
Page 13: Atomicant Drupal 6 Theming
Page 14: Atomicant Drupal 6 Theming
Page 15: Atomicant Drupal 6 Theming
Page 16: Atomicant Drupal 6 Theming
Page 17: Atomicant Drupal 6 Theming
Page 18: Atomicant Drupal 6 Theming
Page 19: Atomicant Drupal 6 Theming
Page 20: Atomicant Drupal 6 Theming
Page 21: Atomicant Drupal 6 Theming
Page 22: Atomicant Drupal 6 Theming
Page 23: Atomicant Drupal 6 Theming
Page 24: Atomicant Drupal 6 Theming
Page 25: Atomicant Drupal 6 Theming
Page 26: Atomicant Drupal 6 Theming
Page 27: Atomicant Drupal 6 Theming
Page 28: Atomicant Drupal 6 Theming
Page 29: Atomicant Drupal 6 Theming
Page 30: Atomicant Drupal 6 Theming
Page 31: Atomicant Drupal 6 Theming
Page 32: Atomicant Drupal 6 Theming
Page 33: Atomicant Drupal 6 Theming
Page 34: Atomicant Drupal 6 Theming
Page 35: Atomicant Drupal 6 Theming
Page 36: Atomicant Drupal 6 Theming
Page 37: Atomicant Drupal 6 Theming
Page 38: Atomicant Drupal 6 Theming
Page 39: Atomicant Drupal 6 Theming
Page 40: Atomicant Drupal 6 Theming
Page 41: Atomicant Drupal 6 Theming
Page 42: Atomicant Drupal 6 Theming
Page 43: Atomicant Drupal 6 Theming
Page 44: Atomicant Drupal 6 Theming
Page 45: Atomicant Drupal 6 Theming
Page 46: Atomicant Drupal 6 Theming
Page 47: Atomicant Drupal 6 Theming
Page 48: Atomicant Drupal 6 Theming
Page 49: Atomicant Drupal 6 Theming

Page rendering – suggestions + preprocess

Page 50: Atomicant Drupal 6 Theming

theme('hook', $arguments)

● theme_breadcrumb, schoolinafrica_links,...● Defined in hook_theme()

function search_theme() {

return array(

'search_theme_form' => array(

'arguments' => array('form' => NULL),

'template' => 'search-theme-form',

),

);

}

Page 51: Atomicant Drupal 6 Theming

hook = function – suggestions

● themeName_hook($arguments)– schoolinafrica_breadcrumbs($arguments)

● engineName_hook($arguments)– phptemplate_hook($arguments)

● theme_hook($aguments)

Page 52: Atomicant Drupal 6 Theming

hook = template – suggestions

● Convert $arguments $variables→● Search for render functions

(theme_render_template)● Search for the function that sets the template files

extension (.tpl.php)

● $variables are passed by reference

Page 53: Atomicant Drupal 6 Theming

hook = template – suggestions

● template_preprocess● template_preprocess_hook● moduleName_preprocess● moduleName_preprocess_hook● engineName_engine_preprocess● engineName_engine_preprocess_hook

Page 54: Atomicant Drupal 6 Theming

hook = template – suggestions

● engineName_preprocess● engineName_preprocess_hook● themeName_preprocess● themeName_preprocess_hook

● Collects suggestions● Find implemented suggestions

(drupal_discover_template)

Page 55: Atomicant Drupal 6 Theming

hook = template – suggestions

● theme_render_template

● Put together .tpl.php

● suggestion.tpl.php

fallback to● hook.tpl.php

Page 56: Atomicant Drupal 6 Theming

Sub-theming

● .info file with base theme defined is enough– base theme = ninesixty

● Sub-themes can share some of the files from base theme

– CSS, js, .tpl.php, overriden functions in template.php● They don't share

– theme-settings.php, logo, color, some of the settings specified in .info file

Page 57: Atomicant Drupal 6 Theming

Sub-theming – how to

● Create new folder in the sites/*/themes folder, give it a name – eg. sites/all/themes/schoolinafrica

● Add .info file with basic valuesname, description,...

● Add “base theme = ninesixty” to .info file● DONE

Subtheming quick and dirty - http://drupal.org/node/441088

Page 58: Atomicant Drupal 6 Theming

Useful tips

● DrupalContrib.org– http://drupalcontrib.org

● admin/settings/performance– CSS + js files optimization

● Base themes– Zen, Ninesixty, Genesis,...

http://drupal.org/project/Themes

Page 59: Atomicant Drupal 6 Theming

Useful tips

● Themer module– http://drupal.org/project/devel_themer

● Firebug – firefox extension - http://getfirebug.com/

Page 60: Atomicant Drupal 6 Theming

Links

● Theming handbook d.o - Drupal 6– http://drupal.org/theme-guide

● Drupal 6.x 7.x guide→– http://drupal.org/update/theme/6/7

● Mailing list– http://drupal.org/mailing-lists

● Theme garden - http://themegarden.org● IRC #drupal-themes

Page 61: Atomicant Drupal 6 Theming

Q&A

Page 62: Atomicant Drupal 6 Theming

Bye and thank you!

Marek SotakDeveloper, designer

co-founder of atomic ant ltd web design company based in London, Prague and Denmark, operates internationaly.

http://twitter.com/sotak

http://facebook.com/sotak

http://atomicant.co.uk

Page 63: Atomicant Drupal 6 Theming

Credits

● Slide 4 by Medical Student on flickr● Slide 44 - http://web.mac.com/moistproduction/flash/index.html

● Slide 61 - http://www.flickr.com/photos/wolfy/2647354470/

● Website preview: http://letsbuildaschoolinafrica.org