SlideShare a Scribd company logo
1 of 34
Download to read offline
Designing for Drupal
    ! Overview of the Layer
      Drupal Theming

    ! Implementation Details
      ! Templates
      ! Preprocessors
      ! Base Themes
    ! Where to go for help
Theming Example
Theming Example
More Zen Examples
More Zen Examples
More Zen Examples
Drupal Design
<?php print "with some PHP" ?>

Drupal Design
Drupal’s Theme Layer
     (the big picture)
Example Theme
Structure of page.tpl.php
Structure of page.tpl.php

           CSS style sheets




                                Search box   .


                              Title
          Conditional Info


                 content
Where do page.tpl.php
variables come from?
What do you need to know?

             •   Your theme doesn’t need
                 all the templates

             •   You don’t need to learn
                 all the variables

             •   Let Drupal’s architecture
                 build parts of your theme
Copy, Override, Modify




Templates and CSS are pulled from lower layers.

  Unless they are overridden in your theme.
Preprocess Functions




 modify variables using a function:
[theme name]_preprocess_[hook]

 e.g. example_preprocess_page
Preprocess Functions


                                            Page Variable
                                            modifications




          modify variables using a function:
         [theme name]_preprocess_[hook]
                                         Node Variable
           e.g. example_preprocess_page   Additions


Put preprocess functions in your theme’s template.php
What was the part in
   the middle?
   http://drupal.org/theme-guide
Base Themes
 Powerful Frameworks for
Beginners and Power Users
Benefits of Base Themes
 •   You don’t have to build everything
     yourself. Copy, override, and modify only
     what you need to.
 •   Bug fixes.
     Others can fix any bugs in the base theme.
 •   New features.
     For contrib Themes, there will occasionally
     be new features.
 •   Support.
     If you have modified an existing theme,
     sometimes the only answer you will get to
     your support question is “Well, it works
     fine in the original theme.”
 •   Rapid Theme Development.
     Many things are built for you.
http://drupal.org/project/zen
Why use Zen?
•   Designed for beginners and Theming ninjas.

•   Extensive on-line documentation.

•   Step-by-step instructions on building your own sub-theme.

•   Extensive in-line comments in its PHP and CSS files.

•   It’s also got a laundry list of features. (which are exciting to use,
    but boring to list.)

•   A fantastically flexible CSS Layout method
    (that even works with IE5.5.)

•   You just met the developer.
Why use Zen?
•   Designed for beginners and Theming ninjas.

•   Extensive on-line documentation.

•   Step-by-step instructions on building your own sub-theme.

•   Extensive in-line comments in its PHP and CSS files.
Brief overview of Zen’s Layout method

•   Source-ordered HTML: The importance of the pieces of content
    determines the order in HTML, and not the graphic design.

•   Flexible layout options:

    •   Fluid (100% width) or fixed-width layout

    •   Optional horizontal navbar

    •   1-3 columns built-in. More columns are possible without
        mind-bending contortions.

•   Zen’s default Layout Method is completely pluggable. If you don’t
    like it, just replace the layout.css file with your own layout
    method: YUI, YAML, Jello Mold, Holy Grail, etc.
Brief overview of Zen’s Layout method

•   Source-ordered HTML: The importance of the pieces of content
    determines the order in HTML, and not the graphic design.

•   Flexible layout options:

    •   Fluid (100% width) or fixed-width layout

    •   Optional horizontal navbar

    •   1-3 columns built-in. More columns are possible without
        mind-bending contortions.

•   Zen’s default Layout Method is completely pluggable. If you don’t
    like it, just replace the layout.css file with your own layout
    method: YUI, YAML, Jello Mold, Holy Grail, etc.
Brief overview of Zen’s Layout method

•   Source-ordered HTML: The importance of the pieces of content
    determines the order in HTML, and not the graphic design.

•   Flexible layout options:

    •   Fluid (100% width) or fixed-width layout

    •   Optional horizontal navbar

    •   1-3 columns built-in. More columns are possible without
        mind-bending contortions.

•   Zen’s default Layout Method is completely pluggable. If you don’t
    like it, just replace the layout.css file with your own layout
    method: YUI, YAML, Jello Mold, Holy Grail, etc.
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Negative Margins
  (and positive results)




  ( These blocks have float: left; )
Getting Help
 http://drupal.org/theme-guide
 http://drupal.org/project/zen
 http://drupal.org/irc
    #drupal-design
    #drupal-themes
    #drupal-support
    #drupal
 Ask Questions!

More Related Content

What's hot

Responsive web design
Responsive web designResponsive web design
Responsive web design
Richa Goel
 
Advanced theming
Advanced themingAdvanced theming
Advanced theming
tlattimore
 

What's hot (9)

Drupal Developer Skills (2012) - DrupalCamp LA 2012
Drupal Developer Skills (2012) - DrupalCamp LA 2012Drupal Developer Skills (2012) - DrupalCamp LA 2012
Drupal Developer Skills (2012) - DrupalCamp LA 2012
 
OOP CSS Presenation
OOP CSS PresenationOOP CSS Presenation
OOP CSS Presenation
 
Color Me Flexible
Color Me FlexibleColor Me Flexible
Color Me Flexible
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
WordPress Theme Workshop: Part 1
WordPress Theme Workshop: Part 1WordPress Theme Workshop: Part 1
WordPress Theme Workshop: Part 1
 
Child Theme Frameworks
Child Theme FrameworksChild Theme Frameworks
Child Theme Frameworks
 
Advanced theming
Advanced themingAdvanced theming
Advanced theming
 
Golden Rules for Effective Alt-Text. AbilityNet Webinar, March 2014
Golden Rules for Effective Alt-Text. AbilityNet Webinar, March 2014Golden Rules for Effective Alt-Text. AbilityNet Webinar, March 2014
Golden Rules for Effective Alt-Text. AbilityNet Webinar, March 2014
 
Copywriting for seo
Copywriting for seoCopywriting for seo
Copywriting for seo
 

Viewers also liked

Viewers also liked (6)

What's new in D7 Theming?
What's new in D7 Theming?What's new in D7 Theming?
What's new in D7 Theming?
 
Style Guide Driven Development: All Hail the Robot Overlords!
Style Guide Driven Development: All Hail the Robot Overlords!Style Guide Driven Development: All Hail the Robot Overlords!
Style Guide Driven Development: All Hail the Robot Overlords!
 
DrupalSouth 2014: Managing Complex Projects with Design Components
DrupalSouth 2014: Managing Complex Projects with Design ComponentsDrupalSouth 2014: Managing Complex Projects with Design Components
DrupalSouth 2014: Managing Complex Projects with Design Components
 
Rocking the Theme Layer
Rocking the Theme LayerRocking the Theme Layer
Rocking the Theme Layer
 
Styleguide-Driven Development: The New Web Development
Styleguide-Driven Development: The New Web DevelopmentStyleguide-Driven Development: The New Web Development
Styleguide-Driven Development: The New Web Development
 
Managing Complex Projects with Design Components - Drupalcon Austin 2014
Managing Complex Projects with Design Components - Drupalcon Austin 2014Managing Complex Projects with Design Components - Drupalcon Austin 2014
Managing Complex Projects with Design Components - Drupalcon Austin 2014
 

Similar to New Adventures in Drupal Theming

Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
Alex Walker
 

Similar to New Adventures in Drupal Theming (20)

Mastering zen
Mastering zenMastering zen
Mastering zen
 
Default theme implementations: a guide for module developers that want sweet ...
Default theme implementations: a guide for module developers that want sweet ...Default theme implementations: a guide for module developers that want sweet ...
Default theme implementations: a guide for module developers that want sweet ...
 
Drupal 7: Theming with Omega
Drupal 7: Theming with OmegaDrupal 7: Theming with Omega
Drupal 7: Theming with Omega
 
Efficient theming in Drupal
Efficient theming in DrupalEfficient theming in Drupal
Efficient theming in Drupal
 
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep dive
 
Drupal: an Overview
Drupal: an OverviewDrupal: an Overview
Drupal: an Overview
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
Rockford WordPress Meetup - Child Themes
Rockford WordPress Meetup - Child ThemesRockford WordPress Meetup - Child Themes
Rockford WordPress Meetup - Child Themes
 
Child Themes and CSS in WordPress
Child Themes and CSS in WordPressChild Themes and CSS in WordPress
Child Themes and CSS in WordPress
 
Drupal - Introduction to Drupal Template Design
Drupal - Introduction to Drupal Template DesignDrupal - Introduction to Drupal Template Design
Drupal - Introduction to Drupal Template Design
 
full-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptxfull-site-editing-theme-presentation.pptx
full-site-editing-theme-presentation.pptx
 
Advanced theming
Advanced themingAdvanced theming
Advanced theming
 
MCC Web Design Workshop
MCC Web Design WorkshopMCC Web Design Workshop
MCC Web Design Workshop
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
 
WordPress Themes and Plugins
WordPress Themes and PluginsWordPress Themes and Plugins
WordPress Themes and Plugins
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
 
Wordpress theme development
Wordpress theme developmentWordpress theme development
Wordpress theme development
 
Theming moodle technical
Theming moodle   technicalTheming moodle   technical
Theming moodle technical
 
April 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child ThemesApril 2016 - Atlanta WordPress Users Group - Child Themes
April 2016 - Atlanta WordPress Users Group - Child Themes
 

More from John Albin Wilkins

More from John Albin Wilkins (12)

Using the CSS Nesting Spec Today
Using the CSS Nesting Spec TodayUsing the CSS Nesting Spec Today
Using the CSS Nesting Spec Today
 
The Drupal Roadmap: From D7 to D9
The Drupal Roadmap: From D7 to D9The Drupal Roadmap: From D7 to D9
The Drupal Roadmap: From D7 to D9
 
Mastering Drupal 8’s Twig
Mastering Drupal 8’s TwigMastering Drupal 8’s Twig
Mastering Drupal 8’s Twig
 
CSS-in-JS: unexpected lessons for Drupal component design
CSS-in-JS: unexpected lessons for Drupal component designCSS-in-JS: unexpected lessons for Drupal component design
CSS-in-JS: unexpected lessons for Drupal component design
 
SassConf: Managing Complex Projects with Design Components
SassConf: Managing Complex Projects with Design ComponentsSassConf: Managing Complex Projects with Design Components
SassConf: Managing Complex Projects with Design Components
 
Drupal Camp Taipei Keynote
Drupal Camp Taipei KeynoteDrupal Camp Taipei Keynote
Drupal Camp Taipei Keynote
 
Become an IA superstar (Chinese version)
Become an IA superstar (Chinese version)Become an IA superstar (Chinese version)
Become an IA superstar (Chinese version)
 
Mobile drupal: building a mobile theme
Mobile drupal: building a mobile themeMobile drupal: building a mobile theme
Mobile drupal: building a mobile theme
 
Sass: CSS with Attitude
Sass: CSS with AttitudeSass: CSS with Attitude
Sass: CSS with Attitude
 
Drupal and the Future of the Web
Drupal and the Future of the WebDrupal and the Future of the Web
Drupal and the Future of the Web
 
Drupal Design Tips
Drupal Design TipsDrupal Design Tips
Drupal Design Tips
 
Making Drupal Dance: Techniques for Non-obvious Theme Manipulations
Making Drupal Dance: Techniques for Non-obvious Theme ManipulationsMaking Drupal Dance: Techniques for Non-obvious Theme Manipulations
Making Drupal Dance: Techniques for Non-obvious Theme Manipulations
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

New Adventures in Drupal Theming

  • 1.
  • 2. Designing for Drupal ! Overview of the Layer Drupal Theming ! Implementation Details ! Templates ! Preprocessors ! Base Themes ! Where to go for help
  • 9. <?php print "with some PHP" ?> Drupal Design
  • 10. Drupal’s Theme Layer (the big picture)
  • 13. Structure of page.tpl.php CSS style sheets Search box . Title Conditional Info content
  • 15. What do you need to know? • Your theme doesn’t need all the templates • You don’t need to learn all the variables • Let Drupal’s architecture build parts of your theme
  • 16. Copy, Override, Modify Templates and CSS are pulled from lower layers. Unless they are overridden in your theme.
  • 17. Preprocess Functions modify variables using a function: [theme name]_preprocess_[hook] e.g. example_preprocess_page
  • 18. Preprocess Functions Page Variable modifications modify variables using a function: [theme name]_preprocess_[hook] Node Variable e.g. example_preprocess_page Additions Put preprocess functions in your theme’s template.php
  • 19. What was the part in the middle? http://drupal.org/theme-guide
  • 20. Base Themes Powerful Frameworks for Beginners and Power Users
  • 21. Benefits of Base Themes • You don’t have to build everything yourself. Copy, override, and modify only what you need to. • Bug fixes. Others can fix any bugs in the base theme. • New features. For contrib Themes, there will occasionally be new features. • Support. If you have modified an existing theme, sometimes the only answer you will get to your support question is “Well, it works fine in the original theme.” • Rapid Theme Development. Many things are built for you.
  • 23. Why use Zen? • Designed for beginners and Theming ninjas. • Extensive on-line documentation. • Step-by-step instructions on building your own sub-theme. • Extensive in-line comments in its PHP and CSS files. • It’s also got a laundry list of features. (which are exciting to use, but boring to list.) • A fantastically flexible CSS Layout method (that even works with IE5.5.) • You just met the developer.
  • 24. Why use Zen? • Designed for beginners and Theming ninjas. • Extensive on-line documentation. • Step-by-step instructions on building your own sub-theme. • Extensive in-line comments in its PHP and CSS files.
  • 25. Brief overview of Zen’s Layout method • Source-ordered HTML: The importance of the pieces of content determines the order in HTML, and not the graphic design. • Flexible layout options: • Fluid (100% width) or fixed-width layout • Optional horizontal navbar • 1-3 columns built-in. More columns are possible without mind-bending contortions. • Zen’s default Layout Method is completely pluggable. If you don’t like it, just replace the layout.css file with your own layout method: YUI, YAML, Jello Mold, Holy Grail, etc.
  • 26. Brief overview of Zen’s Layout method • Source-ordered HTML: The importance of the pieces of content determines the order in HTML, and not the graphic design. • Flexible layout options: • Fluid (100% width) or fixed-width layout • Optional horizontal navbar • 1-3 columns built-in. More columns are possible without mind-bending contortions. • Zen’s default Layout Method is completely pluggable. If you don’t like it, just replace the layout.css file with your own layout method: YUI, YAML, Jello Mold, Holy Grail, etc.
  • 27. Brief overview of Zen’s Layout method • Source-ordered HTML: The importance of the pieces of content determines the order in HTML, and not the graphic design. • Flexible layout options: • Fluid (100% width) or fixed-width layout • Optional horizontal navbar • 1-3 columns built-in. More columns are possible without mind-bending contortions. • Zen’s default Layout Method is completely pluggable. If you don’t like it, just replace the layout.css file with your own layout method: YUI, YAML, Jello Mold, Holy Grail, etc.
  • 28. Negative Margins (and positive results) ( These blocks have float: left; )
  • 29. Negative Margins (and positive results) ( These blocks have float: left; )
  • 30. Negative Margins (and positive results) ( These blocks have float: left; )
  • 31. Negative Margins (and positive results) ( These blocks have float: left; )
  • 32. Negative Margins (and positive results) ( These blocks have float: left; )
  • 33. Negative Margins (and positive results) ( These blocks have float: left; )
  • 34. Getting Help http://drupal.org/theme-guide http://drupal.org/project/zen http://drupal.org/irc #drupal-design #drupal-themes #drupal-support #drupal Ask Questions!