forensic theming - drupalcon london

78
Forensic Theming Design, UX and Theming Emma Jane Hogbin @emmajanedotnet www.designtotheme.com

Upload: emma-jane-hogbin

Post on 08-May-2015

2.335 views

Category:

Technology


1 download

DESCRIPTION

The theme of your website has the capacity for beautiful, semantic markup...and also the hacky HTML soup. You can build a new theme by downloading a free theme and tearing out its guts--or you can learn how to become a theme surgeon.In this session you will learn two key techniques needed to build a successful theme: crime scene investigation (identifying Drupal page elements in your design files) and power tools for copy-cat theming (things you need to recreate your design using Drupal). From start to finish we will transform a design file into a Drupal theme. With special attention given to your all-important questions: how do I save time with grid-based design? Should I use Panels? How do I make this bit of stuff appear next to that bit? Yah, but how do I start?[This presentation was given at DrupalCon Chicago but the recording failed. Slides are available from http://www.slideshare.net/emmajane/forensic-theming-for-drupal]About The PresenterEmma Jane Hogbin is well known in the Drupal community for her engaging presentations and kickass theming book, Front End Drupal. She is currently working on her second book, Drupal: A user's guide which is due out shortly after DrupalCon. Through her training company, Design to Theme, emmajane has empowered thousands of people to create the Drupal site of their dreams.Intended audienceSmall business site builders who partner with graphic designers but have no idea how to make Drupal look like a design file. Intermediate themers who start with a free Drupal theme that looks "close" to the final site and then start hacking to make their theme. The audience currently does not use base themes and are frustrated at how complicated all of the code is. They are looking for shortcuts and some quick-fix solutions to make theming faster and more profitable.Questions answered by this sessionWhat are the key tools I need to use to make themeing Drupal easier?How can I make Drupal markup less yucky?Where should I start when building a new theme?Yeah, but how do I theme *that thing*?I want to see how you build a theme: show me! Presented at: http://london2011.drupal.org/conference/sessions/forensic-theming-key-techniques-building-effective-drupal-themes

TRANSCRIPT

Page 1: Forensic Theming - DrupalCon London

Forensic Theming

Design, UX and Theming

Emma Jane Hogbin

@emmajanedotnet

www.designtotheme.com

Page 2: Forensic Theming - DrupalCon London

drupal.org participation● emmajane● uid: 1773● First look at the Drupal code base: 2003ish.

I stole the i18n table structure.● First Drupal site “for pay”: 2006ish.● First Drupal socks: 2007.

● First DrupalCon conference: Szeged in 2008.● First Drupal book: 2009.

● First Drupal core patch: 2010.Removed the “welcome” screen.

Page 3: Forensic Theming - DrupalCon London

Really Tiny Web Budgets

Page 4: Forensic Theming - DrupalCon London

The Socks

http://www.flickr.com/photos/mortendk/1439332466/

Page 5: Forensic Theming - DrupalCon London

www.emmajane.net/craft/drupal

Page 6: Forensic Theming - DrupalCon London

Book (Co)Author

Page 7: Forensic Theming - DrupalCon London

Workbook Author

www.designtotheme.com

Discount Code: DCLON87488

Valid to the end of August.

Page 8: Forensic Theming - DrupalCon London

Drupal Trainer

www.sitebuildingextravaganza.com

Page 9: Forensic Theming - DrupalCon London

Lazy Front End Developer

Page 10: Forensic Theming - DrupalCon London

I'll just change this one tpl.php filehttp://www.flickr.com/photos/gibbons/2500423526

Page 11: Forensic Theming - DrupalCon London

Okay ... and a module file?

Page 12: Forensic Theming - DrupalCon London

and ...

Page 13: Forensic Theming - DrupalCon London

... everything else too? Bugger.http://www.flickr.com/photos/amagill/3225245292

Page 14: Forensic Theming - DrupalCon London

This presentation is not about ...● Best practices

● Anything advanced

● Design

● Semantic markup

● Responsive Web design

● Typography

● Grids (maybe a little bit)

● CSS optimization

● CSS preprocessing

● Rick Astley

● PHP

● Hooks

● Inheritance● HTML5● Photoshop● Web systems● Theming APIs● Mobile devices● Unicorns● Sprites● In-the-browser design● Sliding doors● Gradients● IE6

Page 15: Forensic Theming - DrupalCon London

Advanced Theming SessionsDisplay Suite

Tuesday 17:00 - NodeOne Road - Fairfield Room

http://tinyurl.com/dclondon-displaysuite

Theming API

Tuesday 15:45 - NodeOne Road - Fairfield Room

http://tinyurl.com/dclondon-themingapi

Responsive Design

Thursday 11am - Axis 12 Street - Arnhem Gallery

http://tinyurl.com/dclondon-responsivedesign

Page 16: Forensic Theming - DrupalCon London

Forensic Theming

Best PracticesDissecting Themes

Page 17: Forensic Theming - DrupalCon London

Agenda

Tools for Forensic Theming● Sweaver● Firebug● Devel Themer

Theming Tools● Sketchbooks● Wireframes● Data models● Grid frameworks

Summary● Questions/Answers● Bonuses

Theme Building● Base themes● Image extraction● MVTs● Forensic styling

● CSS Frameworks

● Base themes

● Layout modules

● Text editors

Page 18: Forensic Theming - DrupalCon London

The Crime

Page 19: Forensic Theming - DrupalCon London

Crime Scene

Page 20: Forensic Theming - DrupalCon London

Forensic Theming

Definition: the art of investigating a Drupal page to find out how that thing got there.

Page 21: Forensic Theming - DrupalCon London

Two Types of Clues

Crime Scene InvestigationWorking with the rendered page:● Available CSS selectors.● Applied CSS styles.

Crime Lab ForensicsWorking with Drupal code files:● Theme templates● Module templates● Hard coded module nonsense

Page 22: Forensic Theming - DrupalCon London

Crime Scene

Working with rendered pages. You can only look at the effects of Drupal on a rendered page.

Page 23: Forensic Theming - DrupalCon London

Identifying CSS SelectorsWith Sweaver

● Common newbie problem: being able to find relevant CSS selectors.

● Sweaver can be used as a pointy-clicky-non-scary CSS class selector.

● Can save/publish minor changes to CSS to live Web sites.

● http://drupal.org/project/sweaver

Page 24: Forensic Theming - DrupalCon London

Sweaver User Interface

Page 25: Forensic Theming - DrupalCon London

Click on Stuff

Page 26: Forensic Theming - DrupalCon London

See How a Selector Will Be Applied

Change CSS propertiesSee the changes

CSS selector to use in your theme

Page 27: Forensic Theming - DrupalCon London

Risky Live Demo

http://d7.sandbox/sweaver

Page 28: Forensic Theming - DrupalCon London

Identifying What's AppliedWith Firebug

● Common newbie problem: trying to identifying what CSS styles are being applied by staring at code.

● Firebug can be used to identify what CSS is actually being applied to a rendered Web page.

● www.getfirebug.com

Page 29: Forensic Theming - DrupalCon London

Locate Properties of Page Elements

Relevant HTML source

Page element CSS styles

Page 30: Forensic Theming - DrupalCon London

Risky Live Firebug Demo● http://d7.sandbox/sbe-site3/● Inspect element.● Edit CSS properties.● Edit CSS files.● Cannot publish changes.● www.getfirebug.com

Page 31: Forensic Theming - DrupalCon London

Other Useful Browser Tools● Web Developer Toolbar

http://chrispederick.com/work/web-developer/● IE Web Developer Toolbar

http://tinyurl.com/ie-web-dev-toolbar

Page 32: Forensic Theming - DrupalCon London

Forensics

Page 33: Forensic Theming - DrupalCon London

Devel / Themer

● The Cadillac of theming tools.● Tells you which tpl.php or theme function is

responsible for that thing displaying over there.● http://drupal.org/project/devel_themer● http://drupal.org/project/devel

Page 34: Forensic Theming - DrupalCon London

Point, Click, Analyse

1. Enable Themer Info2. Click on the thing you want to investigate

3. Analyse the list of functions, templates, variables, etc which control this page element.

Page 35: Forensic Theming - DrupalCon London

Investigate What Themer Reveals

Also go to: http://api.drupal.org

Page 36: Forensic Theming - DrupalCon London

Ooops.

Page 37: Forensic Theming - DrupalCon London

No risky live demo.

Page 38: Forensic Theming - DrupalCon London

Making It Easier

Page 39: Forensic Theming - DrupalCon London

node.tpl.php

page.tpl.php

field.tpl.php

jplayer.tpl.php

Page 40: Forensic Theming - DrupalCon London

content

Page 41: Forensic Theming - DrupalCon London

Pink sherbert photography http://www.flickr.com/photos/pinksherbet/3372060864/

I want less yucky markup!

Page 42: Forensic Theming - DrupalCon London
Page 43: Forensic Theming - DrupalCon London

Less Yucky Markup● European vs American theming● Inheritance: start with a better base.● Base theme: mothership● Modules: Semantic Views● D6 Modules: Semantic CCK● HTML5 http://drupal.org/project/html5_tools

Page 44: Forensic Theming - DrupalCon London

Theming Tools

Page 45: Forensic Theming - DrupalCon London

Sketchbook

Page 46: Forensic Theming - DrupalCon London

Wire Frames

www.balsamiq.com

Page 47: Forensic Theming - DrupalCon London

Data Model

http://www.flickr.com/photos/alan-dean/3513723498

Page 48: Forensic Theming - DrupalCon London

Grid Framework

http://960.gs/

Page 49: Forensic Theming - DrupalCon London

Want to Learn Grids?

Harass @markboulton and tell him to finish his book.

http://www.fivesimplesteps.com/

Do it.

Right now.

Tweet him.

And tell him if he doesn't finish his book you're going to build exclusively 16-column, grid-based Web sites until his book his published.

Page 50: Forensic Theming - DrupalCon London

CSS (Grid) Framework

Page 51: Forensic Theming - DrupalCon London

Base Theme

● drupal.org/project/ninesixty● drupal.org/project/fusion● drupal.org/project/zen

Page 52: Forensic Theming - DrupalCon London

Drupal (Layout) Modules● Context http://drupal.org/project/context ● Display Suite http://drupal.org/project/ds ● Panels http://drupal.org/project/panels

Page 53: Forensic Theming - DrupalCon London

Text Editor

Use anything that doesn't make youwant to punch someone in the face.

Page 54: Forensic Theming - DrupalCon London

Build me a theme!

Page 55: Forensic Theming - DrupalCon London

Steps to Making a Theme

1. Communicate with your whole team.

2. Plan your data structure.

3.Use wire frames to prove what you're saying about how the site ought to be built.

4.Build the site (ignore the theme).

5.Convert your wire frame to a grid layout.

6.Build out the HTML fragments in the relevant tpl.php files.

7. Apply your theme to the site.

8.Refine as necessary based on the UX.

Page 56: Forensic Theming - DrupalCon London

Domicile● Designed by Betty Biesenthal.● Themed by Emma Jane Hogbin.● Available from http://drupal.org/project/domicile● Described in Drupal: a user's guide

Page 57: Forensic Theming - DrupalCon London
Page 58: Forensic Theming - DrupalCon London
Page 59: Forensic Theming - DrupalCon London
Page 60: Forensic Theming - DrupalCon London

Theme Folder

sites/example.com/themes/theme_name   theme_name.info   page.tpl.php

Also: sites/all/themes/base_theme

Page 61: Forensic Theming - DrupalCon London

theme_name.info (1 of 2)name = D7SBE - Domicile

description = A three-column design by Design House (www.design-house.ca) and themed by Design to Theme.

screenshot = screenshot.png

core = 7.x

engine = phptemplate

base theme = ninesixty

; Stylesheets.

stylesheets[all][] = styles.css

; To show the 960.gs grid and debug your theme's layout, delete this section.

; You will be able to remove this when http://drupal.org/node/1032486 is rolled out

stylesheets[all][] = debug.css

Page 62: Forensic Theming - DrupalCon London

theme_name.info (2 of 2); Regions

regions[nav_left] = Navigation (left)

regions[feature_middle] = Feature column (middle)

regions[content] = Content column (right)

regions[copyright_footer] = Copyright notice (footer)

; Features

features[] = logo

features[] = name

features[] = favicon

Page 63: Forensic Theming - DrupalCon London

page.tpl.php

Page 64: Forensic Theming - DrupalCon London
Page 65: Forensic Theming - DrupalCon London
Page 66: Forensic Theming - DrupalCon London
Page 67: Forensic Theming - DrupalCon London
Page 68: Forensic Theming - DrupalCon London
Page 69: Forensic Theming - DrupalCon London

Hard Code Relevant Images

Page 70: Forensic Theming - DrupalCon London

Minimum Viable Theme

Page 71: Forensic Theming - DrupalCon London

Locate Properties of Page Elements

Relevant HTML source

Page element CSS styles

Page 72: Forensic Theming - DrupalCon London

styles.css

Page 73: Forensic Theming - DrupalCon London

Domicile: the theme

Page 74: Forensic Theming - DrupalCon London

Summary● Plan. Think. Build. Test. Theme. Iterate.● Use relevant Drupal modules to break up content and display it

in relevant locations.● Use Sweaver to isolate selectors for your CSS files.● Use Firebug to diagnose and fix CSS problems.● Use Devel to isolate theme functions and variables.● Correlate the number of tpl and PHP files you edit to the size of

your budget and amount of time you have.

Page 75: Forensic Theming - DrupalCon London

Available September 2011

The practical guide to building sites with Drupal.

Pre-order eBook edition on

and SAVE 45%!

Use Coupon Code

IUGD45 at Step 3 of Checkout

Page 76: Forensic Theming - DrupalCon London

Theming Birds of a Feather Sessions● Advanced Theming

Time slot: 24 August 13:45 – 14:45Room 333 Part 1

● Front End DevelopmentTime slot: 25 August 13:30 – 14:30Room 333 Part 2

● Theming in Drupal 8Time slot: 25 August 14:45 – 15:45Room 333 Part 2

Page 77: Forensic Theming - DrupalCon London

What did you think?Locate this session on the DrupalCon London website:http://london2011.drupal.org/conference/schedule

Click the “Take the survey” link

Discounts'n'stuff45% off Drupal User Guidewww.informit.com Code: IUGD45

45% off Design to Theme workbookswww.designtotheme.com Code: DCLON87488

www.sitebuildingextravaganza.com

@[email protected]

Advanced ThemingTime slot: 24 August 13:45 – 14:45Room 333 Part 1

Front End DevelopmentTime slot: 25 August 13:30 – 14:30Room 333 Part 2

Theming in Drupal 8Time slot: 25 August 14:45 – 15:45Room 333 Part 2

BoFs

Page 78: Forensic Theming - DrupalCon London