58
Basic Design for Drupal Emma Jane Hogbin @emmajanedotnet [email protected] www.designtotheme.com

Intro to Theming Drupal, FOSSLC Summer Camp 2010

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Basic Design for Drupal

Emma Jane Hogbin@emmajanedotnet

[email protected]

Page 2: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Overview ofDrupal’s Theming System

Page 3: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Theming WordPressA “pull” system

http://www.f l ickr .com/photos/13879801@N00/96609354/

Page 4: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Theming DrupalA prep and “push” system

Source : http://www.f l ickr .com/photos/sebbisuperstar/2470560831

Page 5: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Flow of Themed Content

Page 6: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Rendered PageLogo

Primary Links

Search Block

View (block)

Login block

Navigation menu

Page 7: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Rendered Page

Region

Node

Node

Node

Primary Links

Logo: Site information

Pager

Menu or Secondary Links

Menu

Footer: Site information

Block

Block

● page.tpl.php● $primary_links● $secondary_links● $logo● $footer_message

● node.tpl.php● block.tpl.php

Page 8: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Which means...

● Drupal uses Theme Engines to style available content independently of the module layer.

● The most commonly used engine is PHPtemplate which is a “prepare and push” system, this differs from WordPress’s “pull” system.

● Complete Web pages of rendered HTML are compiled from different sources in the theme.

● Design for individual Drupal page elements, not the whole page.

Page 9: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating Your First Theme

Page 10: Intro to Theming Drupal, FOSSLC Summer Camp 2010

My Steps for Creating a Theme

0. Create Wireframes

1. Colour palate + grid + imagination + GiMP.

2. Choose a Base Theme. Create a sub-theme.

3. Rebuild the Design Files in Drupal(slice + convert).

4. Launch MVT.

5. Theme by UX, not by module or tpl.php.

Page 11: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 0: Wireframes + Specs

Page 12: Intro to Theming Drupal, FOSSLC Summer Camp 2010
Page 13: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating Front Page Shapes

Page 14: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating Content Page Shapes

Page 15: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Warning!Promotion of

Non-free softwarein the next slide

Page 16: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Drupal Components for BalsamiqCreated by Top Notch Themes

Available from:http://mockupstogo.net/drupal-cms-components

No, Balsamiq is not open source.

Page 17: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 1: Grid + colour palate + imagination + GiMP.

Page 18: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Establish the Framework

1.Grid layout: 960.gs templates

2.Colour palate: colourlovers.com, colorschemedesigner.com

3.Page elements: see wireframes and site specs

Page 19: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating a Basic Design

1.Background: texture, image, colour

2.Place page elements: see wireframes and specs

3.Decorate: texture, flourishes, illustration, photography

4.Typography and font selection

5.Edges and borders: page, block

6.Lists: indents, margins, padding

7.Actions: default, hover, active, .active

Page 20: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Decorating and Designing

If that last slide offended you go watch

http://sf2010.drupal.org/conference/sessions/ stop-decorating-and-start-designing

while I carry on with my decorator lesson for those of us who don’t poop designs for breakfast.

Page 21: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Optimize your Design Files

● Theme by element: node, teaser, blocks, breadcrumbs, pager, site name, shopping cart.

● Sort layers into element-related folders.● Use Web fonts in your design.● Use the 960.gs grid templates.● Create colour palates.● Use a style guide.

Page 22: Intro to Theming Drupal, FOSSLC Summer Camp 2010
Page 23: Intro to Theming Drupal, FOSSLC Summer Camp 2010
Page 24: Intro to Theming Drupal, FOSSLC Summer Camp 2010
Page 25: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Background with Texture

Page 26: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating Front Page Shapes

Page 27: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Grid and Blocks

Page 28: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Creating Front Page Shapes

Page 29: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Page Elements

Page 30: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Change Palate

Page 31: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Change Palate (again)

Page 32: Intro to Theming Drupal, FOSSLC Summer Camp 2010

http://www.scribb leoneverything .com/prints/type-o-f i le/-preorder-so-you-need-a-typeface-poster/prod_260.html

Page 33: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Fill in the Blanks

Page 34: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 2: Choose a Base Theme. Create a sub-theme.

Page 35: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Base Themes

● A base theme is a collection of defaults that you can adjust in your own theme. It is not meant to be used as-is. It is meant to be a foundation of adjustable assumptions.

● DO NOT HACK THE BASE THEME. Use it like a library--reference it, do not hack it.

● Criteria for choosing a base theme: CSS grid framework (or overall layout), SEO, accessibility, additional helper functions, quality of documentation.

Page 36: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Lazy Base Theme: 960.gs

www.drupal.org/project/ninesixty

Page 37: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Super Lazy Base Theme:

Fusion

www.drupal.org/project/fusion

Page 38: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Ultra Powerful Base Theme: Zen

www.drupal.org/project/zen

Page 39: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 3: Rebuild the Design Filesin Drupal.

Page 40: Intro to Theming Drupal, FOSSLC Summer Camp 2010

<html goes here>

Copy the page.tpl.php from your base theme and/or use:http://api.drupal.org/api/drupal/modules--system--page.tpl.php/6/source

Repeat for page-front.tpl.php

Page 41: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 4: Launch YourMinimum Viable Theme

Page 42: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Apply the MVT to a Prototype site

● Work with real data.● Alter as much as possible from within the

Drupal UI. Use ImageCache, CCK and Views.● Compare the prototype site frequently against

your wireframes. Try to make them match.

Page 43: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Uploading your MVTheme

● Base theme: /sites/all/themes

● Your theme: /sites/domainname.com/themes

● Enabling the theme: ?q=/admin/build/themes

● Clear Drupal’s cache● When in doubt, clear Drupal’s cache again.

Page 44: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Step 5: Theme the Rest by UX

Page 45: Intro to Theming Drupal, FOSSLC Summer Camp 2010
Page 46: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Themer Module

Page 47: Intro to Theming Drupal, FOSSLC Summer Camp 2010

You’re a Themer!

http://www.f l ickr .com/photos/14150482@N02/2526889807/

Page 48: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Sharing Your Designs

● Licensing: GPL the “codey bits.”● Creating a project on drupal.org (and also

http://themegarden.org/drupal6/)● Selling your themes

(www.topnotchthemes.com)

Page 49: Intro to Theming Drupal, FOSSLC Summer Camp 2010

My Steps for Creating a Theme

0. Create Wireframes

1. Colour palate + grid + imagination + GiMP.

2. Choose a Base Theme. Create a sub-theme.

3. Rebuild the Design Files in Drupal(slice + convert).

4. Launch MVT.

5. Theme by UX, not by module or tpl.php.

Page 50: Intro to Theming Drupal, FOSSLC Summer Camp 2010

And that was...Basically How You Theme Drupal

Emma Jane Hogbin@emmajanedotnet

[email protected]

Page 51: Intro to Theming Drupal, FOSSLC Summer Camp 2010

It’s too hard.Show me how!

Pink sherbert photography http ://www.f l ickr .com/photos/pinksherbet/3372060864/

Page 52: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Advanced, Extra Stuff

Page 53: Intro to Theming Drupal, FOSSLC Summer Camp 2010

$node object

$node­>nid$node­>body$node­>content['body'][#value]

Page 54: Intro to Theming Drupal, FOSSLC Summer Camp 2010

node.tpl.php (theme: fusion)<?php// $Id: node.tpl.php,v 1.1.2.2 2009/11/11 05:26:25 sociotech Exp $?>

<div id="node­<?php print $node­>nid; ?>" class="node <?php print $node_classes; ?>">  <div class="inner">    <?php print $picture ?> <?php if ($page == 0): ?>    <h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>    <?php endif; ?>   <?php if ($submitted): ?>    <div class="meta">      <span class="submitted"><?php print $submitted ?></span>    </div>    <?php endif; ?> <?php if ($node_top && !$teaser): ?>    <div id="node­top" class="node­top row nested">      <div id="node­top­inner" class="node­top­inner inner">        <?php print $node_top; ?>      </div><!­­ /node­top­inner ­­>    </div><!­­ /node­top ­­>    <?php endif; ?>

    <div class="content clearfix">      <?php print $content ?>    </div> <?php if ($terms): ?>    <div class="terms">      <?php print $terms; ?>    </div>    <?php endif;?> <?php if ($links): ?>    <div class="links">      <?php print $links; ?>    </div>    <?php endif; ?>  </div><!­­ /inner ­­>

  <?php if ($node_bottom && !$teaser): ?>  <div id="node­bottom" class="node­bottom row nested">    <div id="node­bottom­inner" class="node­bottom­inner inner">      <?php print $node_bottom; ?>    </div><!­­ /node­bottom­inner ­­>  </div><!­­ /node­bottom ­­>  <?php endif; ?></div><!­­ /node­<?php print $node­>nid; ?> ­­>

Page 55: Intro to Theming Drupal, FOSSLC Summer Camp 2010

tpl.php files to override styles

● Individual template files make up a whole page (see the handout).

● tpl.php files include: page.tpl.php, node.tpl.php, node-contenttype.tpl.php, comment.tpl.php

● Look at the source of a tpl.php file to find variables that can be moved and altered.

● Use the Devel + Themer Modules● Alter variable contents with

http://drupal.org/node/223430● See also: api.drupal.org

Page 56: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Create Your Theme

1.Make a new folder (start with letters).

2.Add to it a text file named foldername.info

3.Copy the sample settings from the handout into your .info file.

Page 57: Intro to Theming Drupal, FOSSLC Summer Camp 2010

Your Theme’s .info filename = My First Themedescription = Featuring multiple pony­friendly regions.core = 6.xengine = phptemplatebase theme = ninesixty

; Add pony­friendly regions, CSS and Javascript filesregions[shetland] = Left sidebar, column 1stylesheets[all][] = my_theme_styles.cssscripts[] = myscript.js

Page 58: Intro to Theming Drupal, FOSSLC Summer Camp 2010

How to use a Base theme

● Download the base theme and read its documentation.

● Create a new theme folder which references your chosen base theme in the .info file.

● Change only what’s needed. Your sub-theme is the diff from the original base theme.