Advanced Layout Techniques @ CMSExpo

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

Transcript of Advanced Layout Techniques @ CMSExpo

Page 1: Advanced Layout Techniques @ CMSExpo

Advanced Design for Drupal

Emma Jane Hogbin@emmajanedotnet

[email protected]

Page 2: Advanced Layout Techniques @ CMSExpo

Agenda● Why advanced layout modules.● Fusion and Skinr--a CSS selector

toolkit.● Panels for layout.● Context-sensitive content with

Panels.● Moving forward: Making the right

decision for your site.

Page 3: Advanced Layout Techniques @ CMSExpo

I wish the developer and manager would stop

fighting so thatI could just make the

effing theme already.

Applying Styles inVolatile Environments

Page 4: Advanced Layout Techniques @ CMSExpo

Enforce a Style Guide● Skinr allows you to re-use your CSS file of basic

elements.● Re-using your Skinr styles on all projects will ensure no

(common) element gets left behind.● Alternate ways of solving the style guide problem:

● www.tinyurl.com/drupal-fireworks-templates● www.zivtech.com/zivtech-style-guide

Page 5: Advanced Layout Techniques @ CMSExpo

Use Theme Settings + Skinrto Apply Your Stylesto Similar Elements

The following elements:● Headings● Body text● Blocks● Images

May share:● Fonts: Weight, Size, Face,

Colour● Edge styles: Borders +

Padding + Rounded Corners

● Background Colour● Element width and height

Page 6: Advanced Layout Techniques @ CMSExpo

Fusion

Fusion is a theme. Themes can have display settings and groups of CSS attributes (“adjectives”).

Headings

Background colour

Font styles

Edge treatmentsLayout grid

Username formatting

Breadcrumb settings (separator)

Theme Developer Helpers

Page 7: Advanced Layout Techniques @ CMSExpo

Theme Settings(Zen NineSixty & Acquia Prosper)

Page 8: Advanced Layout Techniques @ CMSExpo

Theme Configuration● Fusion settings

alter HTML and apply CSS.

● Blocks are placed into pink regions.

● Individual blocks may be “skinned” to alter their appearance & layout.

Page 9: Advanced Layout Techniques @ CMSExpo

Applying Settings with Skinr● Skinr is a module. Modules can perform tasks

(“verbs”).● Skinr’s GUI replaces custom CSS selectors in

your theme’s CSS files by giving you a pointy-clicky interface to apply your CSS rules.

● Skinr is “just” a selector tool, you must still write CSS rules before you can apply them with the pointy-clicky interface.

Page 10: Advanced Layout Techniques @ CMSExpo

Using Skinr in Your Theme

1.Create re-usable CSS styles in your theme.

2.Add Skinr hooks in the info file.

3.Include the variable $skinr in theme tpls.

4.In the UI, apply skins to applicable page elements.

Page 11: Advanced Layout Techniques @ CMSExpo

Skinr Config SettingsExtracted from acquia_slate.info

; Acquia Slate background styles

skinr[slate­background­styles][title] = Background Styles

skinr[slate­background­styles][type] = radios

skinr[slate­background­styles][features][] = block

skinr[slate­background­styles][features][] = panels_display

skinr[slate­background­styles][features][] = panels_pane

skinr[slate­background­styles][features][] = panels_panel

skinr[slate­background­styles][features][] = views_view

skinr[slate­background­styles][options][1][label] = Dark transparent background

skinr[slate­background­styles][options][1][class] = dark­transparent­background

Page 12: Advanced Layout Techniques @ CMSExpo

Attach the Theme to Skinr

From page.tpl.php<body id="<?php print $body_id; ?>" class="<?php print $body_classes; ?> <?php print $skinr; ?>">

From block.tpl.php<div id="block­<?php print $block­>module .'­'. $block­>delta; ?>" class="block block­<?php print $block­>module ?> <?php print $block_zebra; ?> <?php print $position; ?> <?php print $skinr; ?>">

Page 13: Advanced Layout Techniques @ CMSExpo

Editing Skin (Page) Settings

Page 14: Advanced Layout Techniques @ CMSExpo

Sample Site

Page 15: Advanced Layout Techniques @ CMSExpo

Getting Started with Skinr and Fusion

drupal.org/project/skinr● DrupalConSF Video: http://tinyurl.com/theming-skinr

● Install Skinr: http://tinyurl.com/install-skinr-2x

● Sharing Snippets: http://fusiondrupalthemes.com/snippets

drupal.org/project/fusion● DrupalConSF Video: http://tinyurl.com/theming-fusion

● Webenabled site: http://tinyurl.com/testdrive-fusion

Page 16: Advanced Layout Techniques @ CMSExpo

Point + Click Layout with Panels

Page 17: Advanced Layout Techniques @ CMSExpo

Benefits of PanelsHighly customizable layout without PHP or other theme manipulation. (This is great for clients that can't make up their mind what should be on the front page of a site, or in a specific section.)

Display context-sensitive content. (Use the same layout throughout the site, but unique content displaying based on the taxonomy term selected WITHOUT having to build unique views and have unique page templates).

Place the same block into multiple regions on the same page. (Because Drupal only lets you have a block in one place for your entire Web site.)

Page 18: Advanced Layout Techniques @ CMSExpo

Panels for Layout OnlyUse Panels when:● Your site layout is highly volatile.● You want to display the same block in multiple

regions.

Avoid Panels if:● You can accomplish your layout with finer

grained regions and block settings.● You can easily create duplicates of your blocks.

Page 19: Advanced Layout Techniques @ CMSExpo

2 Column Panel Layout

Page 20: Advanced Layout Techniques @ CMSExpo

...sscrolll down ....

Page 21: Advanced Layout Techniques @ CMSExpo

One Block, Two Places, Three Cheers

Same “random image” block in TWO PLACES AT ONCE!

Page 22: Advanced Layout Techniques @ CMSExpo

Install and Configure Panels● Modules you will need to download:

● Panels● Ctools● Advanced help● Views (and Views UI)

● Modules to Install● (All of the modules listed above)● Page manager● Views content panes● Panel nodes to have panels appear in search results.● Mini panels to divide panes into more panes.

Page 23: Advanced Layout Techniques @ CMSExpo

Panel Dashboard: ready to go

Page 24: Advanced Layout Techniques @ CMSExpo

<insert live demo here>

Page 25: Advanced Layout Techniques @ CMSExpo

Just in case the demo fails:

1. Choose

a layout

2. Add stuff (blocks, nodes, views) to the layout

Page 26: Advanced Layout Techniques @ CMSExpo

Panels Demo Summary

If all went well this is what happened:● Sub-divide $content into multiple

panes.● Add node, blocks, views to the panel

layout.● Assign a custom URL for the panel

page.● Promote the panel to the front page.

Page 27: Advanced Layout Techniques @ CMSExpo

Context-sensitive Content

Page 28: Advanced Layout Techniques @ CMSExpo

http://www.scottberkun.com/wp-content/themes/scottberkun/images/40-1 . jpg

M:M: Ah. I'd like to have an argument, please.Ah. I'd like to have an argument, please.R:R: Certainly sir. Have you been here before?Certainly sir. Have you been here before?M:M: No, I haven't, this is my first time.No, I haven't, this is my first time.

Page 29: Advanced Layout Techniques @ CMSExpo

“Context”● Three contrib modules tackle this problem

for Drupal:● Panels● Context (goes well with CustomPage)● Display Suite

● Efforts are being made to incorporate “context” into core for D8. Yes, eight.

Page 30: Advanced Layout Techniques @ CMSExpo

Context-sensitive Content● Drupal pages know very little about

themselves.● Context allows relationships

between:● page elements.● URLs and page elements.

Page 31: Advanced Layout Techniques @ CMSExpo

Context Rules

Hallway Tracks During PresentationsLast Night

Cussing Clothing

taxonomy

layout options

content displayed

Final page render

Page 32: Advanced Layout Techniques @ CMSExpo

Context Rules

Hallway Tracks During PresentationsLast Night

Cussing Clothing

Page 33: Advanced Layout Techniques @ CMSExpo

Panels for Layout

Page 34: Advanced Layout Techniques @ CMSExpo

Panels with Context, part 1

Page 35: Advanced Layout Techniques @ CMSExpo

Panels with Context, part 2

Page 36: Advanced Layout Techniques @ CMSExpo

Side-By-Side

Page 37: Advanced Layout Techniques @ CMSExpo

Arguments

Page 38: Advanced Layout Techniques @ CMSExpo

Variants Summary

Page 39: Advanced Layout Techniques @ CMSExpo

Content of Variant

Page 40: Advanced Layout Techniques @ CMSExpo

Summary● Use appropriate tools to mitigate

volatile situations.● Abstract styles and re-use them.● Abstract layouts and re-use them.● Skinr, Fusion and Panels are

“advanced layout” modules and themes you may want to try on your site.

Page 41: Advanced Layout Techniques @ CMSExpo

And that was ...Advanced Design for Drupal

Emma Jane Hogbin@emmajanedotnet

[email protected]

Online classes starting May 11