SlideShare a Scribd company logo
1 of 68
Theme Kickstart -
   Converting a HTML/CSS
Template to a Drupal Theme
                   Peter Wolanin

                NJ Drupal meetup, July 7th, 2009
                             Š 2009, Acquia, Inc.
Quick reality check:
- Basic HTML knowledge (tags)
- Basic CSS knowledge (id, class)
- Text editor
- Concept of a variable
- No fear!
Themes turn data into
html - the “presentation”.

     http://drupal.org/theme-guide/6

 A theme is a collection of les
 that dene the presentation layer.
A theme only needs one
 le.



      mytheme.info
Usually it has at least 3.



mytheme.info   page.tpl.php   style.css
Starting from a template
   http://www.solucija.com/free-templates
What les did we get?
Life_Is_Simple/images/content.gif
Life_Is_Simple/images/footer.gif
Life_Is_Simple/images/header.gif
Life_Is_Simple/images/logo.gif
Life_Is_Simple/images/menufooter.gif
Life_Is_Simple/images/menuheader.gif
Life_Is_Simple/images/menulink.gif
Life_Is_Simple/images/rightcontent.gif
Life_Is_Simple/images/rightfooter.gif
Life_Is_Simple/images/rightheader.gif
Life_Is_Simple/images/style.css
Life_Is_Simple/images/Thumbs.db
Life_Is_Simple/index.html
First steps!
          What is a hook?




              http://www. ickr.com/photos/seandreilinger/959870496/
                http:// ickr.com/photos/avelino_maestas/2532426169/
Create a Directory.

sites            all         themes       life-is-simple
Depending on your Drupal source, you may need to create
sites/all/themes
Make the new .info le.
 name = "Life is simple"
 description = Example converted theme
 core = 6.x
 engine = phptemplate

Oh, and I threw in a screenshot.png (approx 150x90 px)
?q=admin/build/themes
Enable an Admin Theme.
    ?q=admin/settings/admin
Enable the theme...
New front page...
Copy in template’s les.
Front page progress...
One little edit later
-<link rel="stylesheet" type="text/css"
  href="images/style.css" />
+<link rel="stylesheet" type="text/css"
   href="sites/all/themes/life-is-simple/images/style.css" />
What’s in Drupal core?
Replace the <head>
Replace the <head>
Replace the <head>
Move style.css up
Find/replace to x paths
 -
 background: url(content.gif) top left;
 +
 background: url(images/content.gif) top left;
Continue replacements
                 -#sadrzaj {
                 +#page {
Continue replacements
                 -#sadrzaj {
                 +#page {
Continue replacements
                 -#sadrzaj {
                 +#page {
Continue replacements
                 -#sadrzaj {
                 +#page {
Continue replacements
Continue replacements
Continue replacements
Continue replacements
Continue replacements
Continue replacements



              -#zaglavlje {
              +#header {

              -#logo {
              +#site-name {
The default regions.
    see: http://drupal.org/node/171224

     regions[left] = Left sidebar
     regions[right] = Right sidebar
     regions[content] = Content
     regions[header] = Header
     regions[footer] = Footer

Since our .info le has no regions de ned, the default values
are added automatically.
Region name = variable.
 We need our Drupal content. It’s this easy!

 <?php   print    $left; ?>
 <?php   print    $right; ?>
 <?php   print    $content; ?>
 <?php   print    $header; ?>
 <?php   print    $footer; ?>
Start links and regions
Start links and regions
Start links and regions
Start links and regions
CSS changed/added
-#lijeva_kolona {
+#sidebar-left {
-#lijeva_kolona a, #lijeva_kolona a:visited {
+#primary a, #primary a:visited {
+#primary ul.links li {
+ padding:0 0;
+}
-#lijeva_kolona a:hover {
+#primary a:hover {
Add the right region
Add the right region




              -#desna_kolona {
              +#sidebar-right {
Add the right region




              -#desna_kolona {
              +#sidebar-right {
Right needs xes too.
Looking at the page source we can see how to select
the “text” styling class for the right:
-.text_desno {
+#sidebar-right .content {
But it still looks wrong because the titles of blocks are
H2 instead of H3.
Right needs xes too.
Looking at the page source we can see how to select
the “text” styling class for the right:
-.text_desno {
+#sidebar-right .content {
But it still looks wrong because the titles of blocks are
H2 instead of H3.
Right needs xes too.
Looking at the page source we can see how to select
the “text” styling class for the right:
-.text_desno {
+#sidebar-right .content {
But it still looks wrong because the titles of blocks are
H2 instead of H3.
Right needs xes too.
Looking at the page source we can see how to select
the “text” styling class for the right:
-.text_desno {
+#sidebar-right .content {
But it still looks wrong because the titles of blocks are
H2 instead of H3.


-h3 {
+#sidebar-right h2 {
Right needs xes too.
Looking at the page source we can see how to select
the “text” styling class for the right:
-.text_desno {
+#sidebar-right .content {
But it still looks wrong because the titles of blocks are
H2 instead of H3.


-h3 {
+#sidebar-right h2 {
Add the content!
Markup doesn’t match



              node.tpl.php

The original template has two nested DIVs to
make the top and bottom of each content item.
Add template for nodes
First round CSS changes
  -.content_title {
  +.content-title {

  -#content_title a, #content_title a:visited {
  +.content-title a, .content-title a:visited {
First round cont’d
-.srednja_kolona {
+#content {
 
 margin-left: 135px;
 
 margin-right: 240px;
 
 max-width: 34em;
+}
+#center-content .node {
 
 background: url(images/content.gif) top left;

-.text {
+#center-content .text {
Search for a
solution




               http:// ickr.com/photos/sovietuk/141381675/
Re-order columns, oat
             #sidebar-right {
  Before:   -
 float: right;
  $left     + float: left;
  $right
  $center    #content {
            -
 margin-left: 135px;
  After:    -
 margin-right: 240px;
  $left     -
 max-width: 34em;
  $center   + float: left;
  $right    +
 width: 34em;
            +#sidebar-right .content li {
            + text-align:left;
Theme hooks?




          http:// ickr.com/photos/avelino_maestas/2532426169/
Theme functions
• phptemplate files (*.tpl.php) are sometimes easier
  to lay out, but cost some performance.
• When the transformation of data to html requires
  a lot of logic (loops or conditionals) like forms.
• There is a default like theme_item_list($list).
• This is invoked as theme(‘item_list’, $list).
• you can make a template.php file in your theme
  and override as hook_item_list() where hook =
  theme name, e.g. lifeissimple_item_list()
Drupal tricks exposed




http:// ickr.com/photos/alkalinezoo/32265389/
Don’t start from scratch
• Drupal 6 provides for easier sub-theming. A sub-
  theme can jsut be a .info le and a little extra CSS.
• For developing a custom theme, find or develop a
  well-functioning theme as a starting point. E.g.
  Zen, Dreamy, even Blue Marine.
• Beware that the core Garland theme is considered
  hard to use as a basis for custom themes.
• Ask for help in #drupal or on drupal.org.
Caching, browsers, etc.
• Rebuild the theme registry by submitting the
  modules page or using cache-clear button.
• Use the theme developer module.
• Make sure CSS and JS aggregation are off.
• Make sure block and page caching are off.
• Use browsershots.org or use VMs to multiple
  OSs/browsers on one machine.
• Use Firebug!
Learn more




             http:// ickr.com/photos/margolove/1252522330/
Other presentations
• http://www.xalking.com/blog/psd-drupal-theme-
  tutorial-part-i (also parts II and III)
• http://www.slideshare.net/rcross/converting-static-
  html-to-drupal-theme-presentation
• http://www.slideshare.net/guest663fb9/bdug-
  drupal-themes-presentation
• http://www.slideshare.net/laurennroth/drupal-
  theming-an-introduction-1640920
http://www.drupalbook.com/   http://frontenddrupal.com/




     http://www.packtpub.com/drupal-6-themes/book
Thank you!
                                         peter.wolanin@acquia.com



This presentation is Š 2009, Acquia, Inc.
Licensed:
http://creativecommons.org/licenses/by-nc-sa/2.0/

More Related Content

What's hot

Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingRobert Carr
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - LondonMarek Sotak
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeAdolfo Nasol
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's newMarek Sotak
 
Atomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingAtomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingMarek Sotak
 
Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceuMarek Sotak
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESSjsmith92
 
Adopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayAdopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayMarek Sotak
 
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)Eugenio Minardi
 
LESS is More
LESS is MoreLESS is More
LESS is Morejsmith92
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibilityjsmith92
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8Logan Farr
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern librariesRuss Weakley
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalChandra Prakash Thapa
 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2Josh Lee
 

What's hot (20)

Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's new
 
Atomicant Drupal 6 Theming
Atomicant Drupal 6 ThemingAtomicant Drupal 6 Theming
Atomicant Drupal 6 Theming
 
Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceu
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Adopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal wayAdopt or hack - how to hack a theme in a Drupal way
Adopt or hack - how to hack a theme in a Drupal way
 
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)
 
A look at Drupal 7 Theming
A look at Drupal 7 ThemingA look at Drupal 7 Theming
A look at Drupal 7 Theming
 
Design to Theme @ CMSExpo
Design to Theme @ CMSExpoDesign to Theme @ CMSExpo
Design to Theme @ CMSExpo
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
 
8 things to know about theming in drupal 8
8 things to know about theming in drupal 88 things to know about theming in drupal 8
8 things to know about theming in drupal 8
 
CSS pattern libraries
CSS pattern librariesCSS pattern libraries
CSS pattern libraries
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 NepalWordPress theme development from scratch : ICT MeetUp 2013 Nepal
WordPress theme development from scratch : ICT MeetUp 2013 Nepal
 
Word press templates
Word press templatesWord press templates
Word press templates
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2
 

Viewers also liked

A Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 MinutesA Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 MinutesSnake Hill Web Agency
 
UX design for every screen
UX design for every screenUX design for every screen
UX design for every screenFour Kitchens
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeSuzanne Dergacheva
 
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming HeadachesSrijan Technologies
 
PSD to a Drupal Theme (using a base theme)
PSD to a Drupal Theme (using a base theme)PSD to a Drupal Theme (using a base theme)
PSD to a Drupal Theme (using a base theme)kuydigital
 
Converting Static Html To Drupal Theme
Converting Static Html To Drupal ThemeConverting Static Html To Drupal Theme
Converting Static Html To Drupal ThemeRyan Cross
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinSuzanne Dergacheva
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Anne Tomasevich
 
Connected Health Reference Architecture
Connected Health Reference ArchitectureConnected Health Reference Architecture
Connected Health Reference ArchitectureWSO2
 
A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 DataWorks Summit
 
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsBest Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsCloudera, Inc.
 

Viewers also liked (12)

A Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 MinutesA Custom Drupal Theme in 40 Minutes
A Custom Drupal Theme in 40 Minutes
 
UX design for every screen
UX design for every screenUX design for every screen
UX design for every screen
 
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 ThemeMinimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
 
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
 
PSD to a Drupal Theme (using a base theme)
PSD to a Drupal Theme (using a base theme)PSD to a Drupal Theme (using a base theme)
PSD to a Drupal Theme (using a base theme)
 
Converting Static Html To Drupal Theme
Converting Static Html To Drupal ThemeConverting Static Html To Drupal Theme
Converting Static Html To Drupal Theme
 
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon DublinCreating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
 
Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8Building a Custom Theme in Drupal 8
Building a Custom Theme in Drupal 8
 
Connected Health Reference Architecture
Connected Health Reference ArchitectureConnected Health Reference Architecture
Connected Health Reference Architecture
 
A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0 A Reference Architecture for ETL 2.0
A Reference Architecture for ETL 2.0
 
What is personal connected health?
What is personal connected health?What is personal connected health?
What is personal connected health?
 
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop ProfessionalsBest Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
Best Practices for the Hadoop Data Warehouse: EDW 101 for Hadoop Professionals
 

Similar to Theme Kickstart

Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress ThemesLaura Hartwig
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme EnlightenmentAmanda Giles
 
ViA Bootstrap 4
ViA Bootstrap 4ViA Bootstrap 4
ViA Bootstrap 4imdurgesh
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themesakosh
 
Drupal theming
Drupal themingDrupal theming
Drupal themingPhilip Norton
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesDamien Carbery
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlJoomla!Days Netherlands
 
WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4David Bisset
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentSitdhibong Laokok
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...LinnAlexandra
 
Efficient theming in Drupal
Efficient theming in DrupalEfficient theming in Drupal
Efficient theming in DrupalCedric Spillebeen
 
Advanced dreamweaver
Advanced dreamweaverAdvanced dreamweaver
Advanced dreamweaverSumit Tambe
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPressNile Flores
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to htmlHawkman Academy
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress themeDave Wallace
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is nowGonzalo Cordero
 

Similar to Theme Kickstart (20)

Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
The Way to Theme Enlightenment
The Way to Theme EnlightenmentThe Way to Theme Enlightenment
The Way to Theme Enlightenment
 
ViA Bootstrap 4
ViA Bootstrap 4ViA Bootstrap 4
ViA Bootstrap 4
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themes
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Child Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notesChild Themes (WordCamp Dublin 2017) with notes
Child Themes (WordCamp Dublin 2017) with notes
 
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nlSource Ordered Templates - - Joomla!Days NL 2009 #jd09nl
Source Ordered Templates - - Joomla!Days NL 2009 #jd09nl
 
WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
Don't Fear the Custom Theme: How to build a custom WordPress theme with only ...
 
Efficient theming in Drupal
Efficient theming in DrupalEfficient theming in Drupal
Efficient theming in Drupal
 
Advanced dreamweaver
Advanced dreamweaverAdvanced dreamweaver
Advanced dreamweaver
 
PSD to WordPress
PSD to WordPressPSD to WordPress
PSD to WordPress
 
Web 101 intro to html
Web 101  intro to htmlWeb 101  intro to html
Web 101 intro to html
 
HTML5 & CSS3 Flag
HTML5 & CSS3 FlagHTML5 & CSS3 Flag
HTML5 & CSS3 Flag
 
Anatomy of a Wordpress theme
Anatomy of a Wordpress themeAnatomy of a Wordpress theme
Anatomy of a Wordpress theme
 
Drupal Theme Development
Drupal Theme DevelopmentDrupal Theme Development
Drupal Theme Development
 
2022 HTML5: The future is now
2022 HTML5: The future is now2022 HTML5: The future is now
2022 HTML5: The future is now
 
Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)Wordpress(css,php,js,ajax)
Wordpress(css,php,js,ajax)
 

Recently uploaded

VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Roomdivyansh0kumar0
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...anilsa9823
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communicationskarancommunications
 
The CMO Survey - Highlights and Insights Report - Spring 2024
The CMO Survey - Highlights and Insights Report - Spring 2024The CMO Survey - Highlights and Insights Report - Spring 2024
The CMO Survey - Highlights and Insights Report - Spring 2024christinemoorman
 
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneVIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...lizamodels9
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear RegressionRavindra Nath Shukla
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Tina Ji
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst SummitHolger Mueller
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewasmakika9823
 
RE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechRE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechNewman George Leech
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Dave Litwiller
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Trucks in Minnesota
 

Recently uploaded (20)

VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Greater Noida ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
 
Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.Eni 2024 1Q Results - 24.04.24 business.
Eni 2024 1Q Results - 24.04.24 business.
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Pharma Works Profile of Karan Communications
Pharma Works Profile of Karan CommunicationsPharma Works Profile of Karan Communications
Pharma Works Profile of Karan Communications
 
The CMO Survey - Highlights and Insights Report - Spring 2024
The CMO Survey - Highlights and Insights Report - Spring 2024The CMO Survey - Highlights and Insights Report - Spring 2024
The CMO Survey - Highlights and Insights Report - Spring 2024
 
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service PuneVIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Kirti 8617697112 Independent Escort Service Pune
 
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
 
Regression analysis: Simple Linear Regression Multiple Linear Regression
Regression analysis:  Simple Linear Regression Multiple Linear RegressionRegression analysis:  Simple Linear Regression Multiple Linear Regression
Regression analysis: Simple Linear Regression Multiple Linear Regression
 
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
Russian Faridabad Call Girls(Badarpur) : ☎ 8168257667, @4999
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
 
Progress Report - Oracle Database Analyst Summit
Progress  Report - Oracle Database Analyst SummitProgress  Report - Oracle Database Analyst Summit
Progress Report - Oracle Database Analyst Summit
 
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service DewasVip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
Vip Dewas Call Girls #9907093804 Contact Number Escorts Service Dewas
 
RE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechRE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman Leech
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 

Theme Kickstart

  • 1. Theme Kickstart - Converting a HTML/CSS Template to a Drupal Theme Peter Wolanin NJ Drupal meetup, July 7th, 2009 Š 2009, Acquia, Inc.
  • 2. Quick reality check: - Basic HTML knowledge (tags) - Basic CSS knowledge (id, class) - Text editor - Concept of a variable - No fear!
  • 3. Themes turn data into html - the “presentation”. http://drupal.org/theme-guide/6 A theme is a collection of les that dene the presentation layer.
  • 4. A theme only needs one le. mytheme.info
  • 5. Usually it has at least 3. mytheme.info page.tpl.php style.css
  • 6. Starting from a template http://www.solucija.com/free-templates
  • 7. What les did we get? Life_Is_Simple/images/content.gif Life_Is_Simple/images/footer.gif Life_Is_Simple/images/header.gif Life_Is_Simple/images/logo.gif Life_Is_Simple/images/menufooter.gif Life_Is_Simple/images/menuheader.gif Life_Is_Simple/images/menulink.gif Life_Is_Simple/images/rightcontent.gif Life_Is_Simple/images/rightfooter.gif Life_Is_Simple/images/rightheader.gif Life_Is_Simple/images/style.css Life_Is_Simple/images/Thumbs.db Life_Is_Simple/index.html
  • 8. First steps! What is a hook? http://www. ickr.com/photos/seandreilinger/959870496/ http:// ickr.com/photos/avelino_maestas/2532426169/
  • 9. Create a Directory. sites all themes life-is-simple Depending on your Drupal source, you may need to create sites/all/themes
  • 10. Make the new .info le. name = "Life is simple" description = Example converted theme core = 6.x engine = phptemplate Oh, and I threw in a screenshot.png (approx 150x90 px)
  • 12. Enable an Admin Theme. ?q=admin/settings/admin
  • 17. One little edit later -<link rel="stylesheet" type="text/css" href="images/style.css" /> +<link rel="stylesheet" type="text/css" href="sites/all/themes/life-is-simple/images/style.css" />
  • 23. Find/replace to x paths - background: url(content.gif) top left; + background: url(images/content.gif) top left;
  • 24. Continue replacements -#sadrzaj { +#page {
  • 25. Continue replacements -#sadrzaj { +#page {
  • 26. Continue replacements -#sadrzaj { +#page {
  • 27. Continue replacements -#sadrzaj { +#page {
  • 33. Continue replacements -#zaglavlje { +#header { -#logo { +#site-name {
  • 34. The default regions. see: http://drupal.org/node/171224 regions[left] = Left sidebar regions[right] = Right sidebar regions[content] = Content regions[header] = Header regions[footer] = Footer Since our .info le has no regions de ned, the default values are added automatically.
  • 35. Region name = variable. We need our Drupal content. It’s this easy! <?php print $left; ?> <?php print $right; ?> <?php print $content; ?> <?php print $header; ?> <?php print $footer; ?>
  • 36. Start links and regions
  • 37. Start links and regions
  • 38. Start links and regions
  • 39. Start links and regions
  • 40. CSS changed/added -#lijeva_kolona { +#sidebar-left { -#lijeva_kolona a, #lijeva_kolona a:visited { +#primary a, #primary a:visited { +#primary ul.links li { + padding:0 0; +} -#lijeva_kolona a:hover { +#primary a:hover {
  • 41. Add the right region
  • 42. Add the right region -#desna_kolona { +#sidebar-right {
  • 43. Add the right region -#desna_kolona { +#sidebar-right {
  • 44. Right needs xes too. Looking at the page source we can see how to select the “text” styling class for the right: -.text_desno { +#sidebar-right .content { But it still looks wrong because the titles of blocks are H2 instead of H3.
  • 45. Right needs xes too. Looking at the page source we can see how to select the “text” styling class for the right: -.text_desno { +#sidebar-right .content { But it still looks wrong because the titles of blocks are H2 instead of H3.
  • 46. Right needs xes too. Looking at the page source we can see how to select the “text” styling class for the right: -.text_desno { +#sidebar-right .content { But it still looks wrong because the titles of blocks are H2 instead of H3.
  • 47. Right needs xes too. Looking at the page source we can see how to select the “text” styling class for the right: -.text_desno { +#sidebar-right .content { But it still looks wrong because the titles of blocks are H2 instead of H3. -h3 { +#sidebar-right h2 {
  • 48. Right needs xes too. Looking at the page source we can see how to select the “text” styling class for the right: -.text_desno { +#sidebar-right .content { But it still looks wrong because the titles of blocks are H2 instead of H3. -h3 { +#sidebar-right h2 {
  • 50. Markup doesn’t match node.tpl.php The original template has two nested DIVs to make the top and bottom of each content item.
  • 52. First round CSS changes -.content_title { +.content-title { -#content_title a, #content_title a:visited { +.content-title a, .content-title a:visited {
  • 53. First round cont’d -.srednja_kolona { +#content { margin-left: 135px; margin-right: 240px; max-width: 34em; +} +#center-content .node { background: url(images/content.gif) top left; -.text { +#center-content .text {
  • 54.
  • 55. Search for a solution http:// ickr.com/photos/sovietuk/141381675/
  • 56. Re-order columns, oat #sidebar-right { Before: - float: right; $left + float: left; $right $center #content { - margin-left: 135px; After: - margin-right: 240px; $left - max-width: 34em; $center + float: left; $right + width: 34em; +#sidebar-right .content li { + text-align:left;
  • 57.
  • 58. Theme hooks? http:// ickr.com/photos/avelino_maestas/2532426169/
  • 59. Theme functions • phptemplate les (*.tpl.php) are sometimes easier to lay out, but cost some performance. • When the transformation of data to html requires a lot of logic (loops or conditionals) like forms. • There is a default like theme_item_list($list). • This is invoked as theme(‘item_list’, $list). • you can make a template.php le in your theme and override as hook_item_list() where hook = theme name, e.g. lifeissimple_item_list()
  • 60. Drupal tricks exposed http:// ickr.com/photos/alkalinezoo/32265389/
  • 61. Don’t start from scratch • Drupal 6 provides for easier sub-theming. A sub- theme can jsut be a .info le and a little extra CSS. • For developing a custom theme, nd or develop a well-functioning theme as a starting point. E.g. Zen, Dreamy, even Blue Marine. • Beware that the core Garland theme is considered hard to use as a basis for custom themes. • Ask for help in #drupal or on drupal.org.
  • 62. Caching, browsers, etc. • Rebuild the theme registry by submitting the modules page or using cache-clear button. • Use the theme developer module. • Make sure CSS and JS aggregation are off. • Make sure block and page caching are off. • Use browsershots.org or use VMs to multiple OSs/browsers on one machine. • Use Firebug!
  • 63. Learn more http:// ickr.com/photos/margolove/1252522330/
  • 64.
  • 65.
  • 66. Other presentations • http://www.xalking.com/blog/psd-drupal-theme- tutorial-part-i (also parts II and III) • http://www.slideshare.net/rcross/converting-static- html-to-drupal-theme-presentation • http://www.slideshare.net/guest663fb9/bdug- drupal-themes-presentation • http://www.slideshare.net/laurennroth/drupal- theming-an-introduction-1640920
  • 67. http://www.drupalbook.com/ http://frontenddrupal.com/ http://www.packtpub.com/drupal-6-themes/book
  • 68. Thank you! peter.wolanin@acquia.com This presentation is Š 2009, Acquia, Inc. Licensed: http://creativecommons.org/licenses/by-nc-sa/2.0/

Editor's Notes

  1. - Here are the tools you&amp;#x2019;ll need to follow along and reproduce this
  2. - You have data (like the content of your nodes) in the database - you need to &amp;#x201C;present&amp;#x201D; that data as html to site visitors
  3. - An .info file which is in .ini (text) format. - Naming it .info lets Drupal find the file.
  4. - An .info file which is in .ini (text) format. - A php file called page.tpl.php - this is a phptemplate file - A .css file with the default name style.css.
  5. - If you want to contribute your theme to drupal.org it must be GPL or compatible (public domain, new BSD, etc). - For your own site starting from a Creative Commons licensed template is fine, but you can&amp;#x2019;t include it in drupal.org CVS as a project.
  6. - Most templates will have a css file and an index.html file - these will be the basis for our style.css and page.tpl.php
  7. - We need to get Drupal to recognize our new theme exists. - After enabling the theme we can figure out how to move forward.
  8. - Put all your custom themes in sites/all/themes
  9. - Most templates will have a css file and an index.html file - these will be the basis for our style.css and page.tpl.php
  10. - with just the .info file (and the bonus a screenshot) our theme shows up on the admin screen.
  11. - Having an administrative theme will allow us to admin the site even while our new theme is not yet functional.
  12. - A theme with just a .info file use any and all default theme elements - This gives you an idea of what the html from Drupal looks like with no CSS.
  13. - A theme with just a .info file use any and all default theme elements - This gives you an idea of what the html from Drupal looks like with no CSS.
  14. - Put all your custom themes in sites/all/themes
  15. - We now have the html, but are missing the CSS
  16. - Correcting the CSS path makes gives us just the dummy content
  17. - let&amp;#x2019;s open up the page.tpl.php that comes with system module
  18. - We replace the hard-coded CSS with the printed content of a variable. - Same for other values in this part of the document.
  19. - We replace the hard-coded CSS with the printed content of a variable. - Same for other values in this part of the document.
  20. - We replace the hard-coded CSS with the printed content of a variable. - Same for other values in this part of the document.
  21. - In the css url(foo.gif) gets renamed to url(images/foo.gif) - The browser bar now reflects our site name.
  22. - What language was this in - anyhow, we can match the structure.
  23. - What language was this in - anyhow, we can match the structure.
  24. - What language was this in - anyhow, we can match the structure.
  25. - What language was this in - anyhow, we can match the structure.
  26. - What language was this in - anyhow, we can match the structure.
  27. - What language was this in - anyhow, we can match the structure.
  28. - What language was this in - anyhow, we can match the structure.
  29. - What language was this in - anyhow, we can match the structure.
  30. - What language was this in - anyhow, we can match the structure.
  31. - Regions are labels for where blocks and other content appear - For a simple theme the defaults are likely to be sufficient
  32. - In the template file we can call print $name; for each region defined in .info, or in tis case for the default regions.
  33. - A little unexpected padding around the list items
  34. - A little unexpected padding around the list items
  35. - A little unexpected padding around the list items
  36. - Zero out the padding and life is simple again
  37. - We can get part of the way there with this simple change
  38. - We can get part of the way there with this simple change
  39. - We can get part of the way there with this simple change
  40. - We can get part of the way there with this simple change
  41. - We can get part of the way there with this simple change
  42. - We can get part of the way there with this simple change
  43. - Zero out the padding and life is simple again
  44. - Add a node.tpl.php
  45. - Add a node.tpl.php
  46. - Zero out the padding and life is simple again
  47. - Zero out the padding and life is simple again
  48. - Apparently the extra wrapper div for the #content region isn&amp;#x2019;t playing well with the CSS