SlideShare a Scribd company logo
1 of 44
Download to read offline
Theming in Drupal
   An introduction to theming !
   with a little Drupal 7 twist!
                 !
Drupal Camp Edinburgh May 2011!
     Rob Carr @robertgcarr!
What’s covered…
Prereqs.!
Theming concepts.!
Theme components.!
Hardcore.!
Tools.!
Pre-requisites for Theming Adventures
HTML.!
CSS.!
Basics of Drupal.!
Some idea of PHP.!
‘Some idea of PHP:’
•  Print variables!
•  Logic (if… then)!
•  Call functions!


   For the braver:
 Arrays and Objects
  knowledge useful
Theming Options
Core theme!             	
  	
  
                                   Garland!
Off the Shelf:!
                                         !
•  Contributed (d.o)!
                                    Bartik!
•  Purchase!                             !
Scratch (hardcore!)!                Seven!
Sub-theme!                               !
!                                    Stark!
     Never hack
      a theme
Sub Theme?
Select [base] theme.!   	
  	
  
Override elements
                                   Base theme!
you don’t like.!
Add custom PHP
snippets, HTML,
CSS or JS.!                        Sub theme!
                                   (your custom code)"




    Never hack
     a theme
What is a Theme?
A folder full of code:!
•  Manifest (.info)"
•  Templates (.tpl.php)"
•  Styles (.css)"
•  Logic (template.php)"
•  JavaScript (.js)"
"
    Custom themes live in:	

      /sites/all/themes/
         themename
Manifest: yourtheme.info
                      ;	
  DESCRIPTION	
  

Theme description.!   name	
  =	
  yourtheme	
  
                      descrip=on	
  =	
  A	
  flexible,	
  simple	
  custom	
  theme	
  based	
  on	
  Bar=k.	
  
                      	
  
                      ;	
  REQUIREMENTS	
  

Requirements.!        core	
  =	
  7.x	
  
                      base	
  theme	
  =	
  bar=k	
  
                      	
  
                      ;	
  STYLESHEETS	
  

Stylesheets.!         stylesheets[all][]	
  =	
  layout.css	
  
                      stylesheets[all][]	
  =	
  style.css	
  
                      stylesheets[print][]	
  =	
  print.css	
  
                      	
  
Regions.!             ;	
  REGIONS	
  
                      regions[header]	
  =	
  Header	
  
                      regions[help]	
  =	
  Help	
  

Scripts.!
                      regions[page_top]	
  =	
  Page	
  top	
  
                      regions[page_boSom]	
  =	
  Page	
  boSom	
  
                      regions[highlighted]	
  =	
  Highlighted	
  
                      regions[naviga=on]	
  =	
  Naviga=on	
  

(Features).!          regions[content]	
  =	
  Content	
  
                      regions[sidebar_first]	
  =	
  Sidebar	
  first	
  
                      regions[sidebar_second]	
  =	
  Sidebar	
  second	
  
                      regions[footer]	
  =	
  Footer	
  

(Settings).!          	
  
                      ;	
  SCRIPTS	
  
                      scripts[]	
  =	
  scripts.js	
  
                      	
  
CSS
Cascading Style Sheets –
  inherit or override!
Regions

;	
  REGIONS	
  
regions[header]	
  =	
  Header	
  
regions[help]	
  =	
  Help	
  
regions[page_top]	
  =	
  Page	
  top	
  
regions[page_boSom]	
  =	
  Page	
  boSom	
  
regions[highlighted]	
  =	
  Highlighted	
  
regions[naviga=on]	
  =	
  Naviga=on	
  
regions[content]	
  =	
  Content	
  
regions[sidebar_first]	
  =	
  Sidebar	
  first	
  
regions[sidebar_second]	
  =	
  Sidebar	
  
second	
  
regions[footer]	
  =	
  Footer	
  
Templating
Templates
html.tpl.php – master       region.tpl.php"

template; includes
<HEAD> content.!
                              field.tpl.php"
!                                               block.tpl.php"

page.tpl.php – layout of
all <BODY> content.!
!                                               block.tpl.php"
                            node.tpl.php"
node.tpl.php –
                                              region.tpl.php"



individual nodes (pieces    region.tpl.php"

of content).!               page.tpl.php"
                           html.tpl.php"
html.tpl.php




               Theme:	
  Sky	
  (HTML5	
  theme)	
  
html.tpl.php – Generated
Template variables



  $page – rendered page
  content – page.tpl.php
page.tpl.php
page.tpl.php variables

   <?php	
  if	
  ($site_slogan):	
  ?>	
  
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <h2	
  class="site-­‐slogan"><?php	
  print	
  $site_slogan;	
  ?></h2>	
  
   <?php	
  endif;	
  ?>	
  




http://api.drupal.org/api/drupal/modules--system--page.tpl.php/7"
page.tpl.php regions




      <?php	
  print	
  render($page[region_name]);	
  ?>	
  

The array $page contains all region content for that particular page"
node.tpl.php
Renders the content of a
node and all its
components:!
•  Title!
•  Main body!
•  Author!
•  Links (taxonomy etc)!
•  Comments!
Different Content (node) types
Node type:!                     Template:"
•  Article!                     •  node--article.tpl.php"
•  Blog!                        •  node--blog.tpl.php"
•  Event!                       •  node--event.tpl.php"
•  Project!                     •  node--project.tpl.php"

                 Don’t have to define
                 node.tpl.php to have            It’s a

                                                 --	

                                                double	

              nodetype-specific templates
Sub Theming - Templates
You don’t have to    Base theme Your theme	

define every single     html.tpl.php"
template if it
doesn’t need           page.tpl.php"   page.tpl.php"
changing.!
                       node.tpl.php"   node.tpl.php"
Templates… and finally
You can also create
tpl.php files for Views. !
!
Edit View > Advanced >
> Information!
Templates… and finally
You can also create
tpl.php files for
Views too. !
!
Edit View >
Advanced > >
Information!
Logic
Q. Where does the
HTML contents of
                           We can override
the variables come
                          this HTML output
from?!
                           by altering any
!                        themable function
A. theme()!              and even add our
                            own variables"
theme()
1.  Menu system receives
    page request.!
2.  Node data built and
    template applied.!
3.  Node HTML
    generated.!
4.  Preprocessing to
    generate HTML for
    blocks in each region.!
5.  Page template
    applied.!
Example - Breadcrumb
How Drupal Outputs Breadcrumb
Drupal looks for:!
1.  yourtheme_breadcrumb().!
2.  sites/all/themes/yourtheme/breadcrumb.tpl.php!
3.  theme_breadcrumb().!


                   Generates (example):"
                   "
                   Home » contact us"
Overide theme_breadcrumb()




 Example:"            Becomes:"
 "                    "
 Home » contact us"   Home   contact us"
A home for our theme function:
Any custom theme functions live in:!
!
!    sites/all/themes/yourtheme/template.php	

!
And so much more…!
template.php
Contains function overrides and can add/
replace template variables for our theme.!
!
    <theme name>_preprocess_<template name>	

!
Examples:!
yourtheme_preprocess_page(&$vars)"
yourtheme_preprocess_html(&$vars)"
Add variable example
Insert into template.php:!
!
!
!
Add to node.tpl.php:!
!
!
Clear the cache…!
Add variable example
Insert into template.php:!
!
!
!
Add to node.tpl.php:!
!
          Clear caches"




!
Clear the cache…!
Congrats!
You’ve now built a
theme!!
!
But what next: how can
I keep tweaking?!
Tools
Firebug (Plugin for FF, Firebug-Lite for others)!
IE Developer!
Drupal Functions
Drupal API: !
http://api.drupal.org/!
!
Contrib Modules API:
http://drupalcontrib.org/api/drupal!

!
Template Variables
HTML:
http://api.drupal.org/api/
drupal/modules--system--
html.tpl.php/7!
!
Page:
http://api.drupal.org/api/
drupal/modules--system--
page.tpl.php/7!
!
Node:
http://api.drupal.org/api/
drupal/modules--node--
node.tpl.php/7!
!
The Killer App!
Theme Developer Module
http://drupal.org/project/devel_themer!
!
See also Drupal for Firebug (a bit hardcore)!
http://drupal.org/project/drupalforfirebug!
!
The Killer App!
Theme Developer Module
http://drupal.org/project/devel_themer!
!
See also Drupal for Firebug (a bit hardcore)!
http://drupal.org/project/drupalforfirebug!
!
Top Tip:


 Never eat
yellow snow
Top Tip:
            Clear the
             caches!

           Never eat
                  	

         yellow snow
/admin/config/development/performance/	

          (‘Clear all caches’)	

                   	

                  Or	

              drush cc all	

                    	

                   	

                   "
Drupal 6
Well I mastered theming in Drupal 6, but
what changed when Drupal 7 was released?!
!
Too much to talk about here, but a great list
is at:!
http://drupal.org/update/themes/6/7!
Packt – Drupal 7 Themes

Only hard copy book
available at time of
presentation -
published June 2011!
!
Again!
We covered the basics:!
•  Theme components !
•  Templates!
•  Overriding theme()!
•  Tools!
•  Reference!
FIN

More Related Content

What's hot

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
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to themingBrahampal Singh
 
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
 
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
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Emma Jane Hogbin Westby
 
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
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Ryan Price
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12ucbdrupal
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeAdam Darowski
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme KickstartPeter
 
Absolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalAbsolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalRod Martin
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2Josh Lee
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentSitdhibong Laokok
 
Twig for Drupal 8 and PHP | Presented at OC Drupal
Twig for Drupal 8 and PHP | Presented at OC DrupalTwig for Drupal 8 and PHP | Presented at OC Drupal
Twig for Drupal 8 and PHP | Presented at OC Drupalwebbywe
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designerselliotjaystocks
 
PyGrunn 2017 - Django Performance Unchained - slides
PyGrunn 2017 - Django Performance Unchained - slidesPyGrunn 2017 - Django Performance Unchained - slides
PyGrunn 2017 - Django Performance Unchained - slidesArtur Barseghyan
 

What's hot (20)

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
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to theming
 
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
 
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)
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009
 
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
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011
 
BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12BDUG Responsive Web Theming - 7/23/12
BDUG Responsive Web Theming - 7/23/12
 
NewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress ThemeNewBCamp09: Turning your design into a WordPress Theme
NewBCamp09: Turning your design into a WordPress Theme
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme Kickstart
 
Absolute Beginners Guide to Drupal
Absolute Beginners Guide to DrupalAbsolute Beginners Guide to Drupal
Absolute Beginners Guide to Drupal
 
Plone 5 theming
Plone 5 themingPlone 5 theming
Plone 5 theming
 
Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3Intro to HTML 5 / CSS 3
Intro to HTML 5 / CSS 3
 
WordPress Theme Development: Part 2
WordPress Theme Development: Part 2WordPress Theme Development: Part 2
WordPress Theme Development: Part 2
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
Twig for Drupal 8 and PHP | Presented at OC Drupal
Twig for Drupal 8 and PHP | Presented at OC DrupalTwig for Drupal 8 and PHP | Presented at OC Drupal
Twig for Drupal 8 and PHP | Presented at OC Drupal
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
PyGrunn 2017 - Django Performance Unchained - slides
PyGrunn 2017 - Django Performance Unchained - slidesPyGrunn 2017 - Django Performance Unchained - slides
PyGrunn 2017 - Django Performance Unchained - slides
 
Drupal Front End PHP
Drupal Front End PHPDrupal Front End PHP
Drupal Front End PHP
 

Viewers also liked

Tips Bootstrap 3 en Drupal 7
Tips Bootstrap 3 en Drupal 7Tips Bootstrap 3 en Drupal 7
Tips Bootstrap 3 en Drupal 7SuperSoft
 
Introduction to Joomla SEO
Introduction to Joomla SEOIntroduction to Joomla SEO
Introduction to Joomla SEOalledia
 
Introduction to Drupal, Wayne Eaker, Nov 11, 09
Introduction to Drupal, Wayne Eaker, Nov 11, 09 Introduction to Drupal, Wayne Eaker, Nov 11, 09
Introduction to Drupal, Wayne Eaker, Nov 11, 09 Lunch Ann Arbor Marketing
 
MAMP: Building WordPress sites in your local environment
MAMP: Building WordPress sites in your local environmentMAMP: Building WordPress sites in your local environment
MAMP: Building WordPress sites in your local environmentLiam Dempsey
 
Introduction to WordPress - Adam W. Warner
Introduction to WordPress - Adam W. WarnerIntroduction to WordPress - Adam W. Warner
Introduction to WordPress - Adam W. WarnerAdam W. Warner
 
Quick introduction to joomla
Quick introduction to joomlaQuick introduction to joomla
Quick introduction to joomlaSabuj Kundu
 
Joomla Introduction & Installation Tutorial
Joomla Introduction & Installation TutorialJoomla Introduction & Installation Tutorial
Joomla Introduction & Installation TutorialSingsys Pte Ltd
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To DrupalLauren Roth
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressHarshad Mane
 
Introduction to Drupal for Absolute Beginners
Introduction to Drupal for Absolute BeginnersIntroduction to Drupal for Absolute Beginners
Introduction to Drupal for Absolute Beginnerseverlearner
 
WordPress For Beginners - Serbian Version
WordPress For Beginners - Serbian VersionWordPress For Beginners - Serbian Version
WordPress For Beginners - Serbian VersionStevica Gološin
 
WordPress SEO & Optimisation
WordPress SEO & OptimisationWordPress SEO & Optimisation
WordPress SEO & OptimisationJoost de Valk
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPressEunus Hosen
 
Developing Locally with WordPress: No More Cowboy Coding
Developing Locally with WordPress: No More Cowboy CodingDeveloping Locally with WordPress: No More Cowboy Coding
Developing Locally with WordPress: No More Cowboy CodingMatt Banks
 
LinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedLinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedSlideShare
 

Viewers also liked (19)

Tips Bootstrap 3 en Drupal 7
Tips Bootstrap 3 en Drupal 7Tips Bootstrap 3 en Drupal 7
Tips Bootstrap 3 en Drupal 7
 
Introduction to Joomla SEO
Introduction to Joomla SEOIntroduction to Joomla SEO
Introduction to Joomla SEO
 
Introduction to Drupal, Wayne Eaker, Nov 11, 09
Introduction to Drupal, Wayne Eaker, Nov 11, 09 Introduction to Drupal, Wayne Eaker, Nov 11, 09
Introduction to Drupal, Wayne Eaker, Nov 11, 09
 
Joomla Introduction Summer2008
Joomla Introduction Summer2008Joomla Introduction Summer2008
Joomla Introduction Summer2008
 
MAMP: Building WordPress sites in your local environment
MAMP: Building WordPress sites in your local environmentMAMP: Building WordPress sites in your local environment
MAMP: Building WordPress sites in your local environment
 
Introduction to WordPress - Adam W. Warner
Introduction to WordPress - Adam W. WarnerIntroduction to WordPress - Adam W. Warner
Introduction to WordPress - Adam W. Warner
 
Quick introduction to joomla
Quick introduction to joomlaQuick introduction to joomla
Quick introduction to joomla
 
Joomla Introduction & Installation Tutorial
Joomla Introduction & Installation TutorialJoomla Introduction & Installation Tutorial
Joomla Introduction & Installation Tutorial
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 
Introduction to Drupal for Absolute Beginners
Introduction to Drupal for Absolute BeginnersIntroduction to Drupal for Absolute Beginners
Introduction to Drupal for Absolute Beginners
 
WordPress For Beginners - Serbian Version
WordPress For Beginners - Serbian VersionWordPress For Beginners - Serbian Version
WordPress For Beginners - Serbian Version
 
An Introduction to Drupal
An Introduction to DrupalAn Introduction to Drupal
An Introduction to Drupal
 
Drupal end.ppt
Drupal end.pptDrupal end.ppt
Drupal end.ppt
 
Introduction to WordPress
Introduction to WordPress Introduction to WordPress
Introduction to WordPress
 
WordPress SEO & Optimisation
WordPress SEO & OptimisationWordPress SEO & Optimisation
WordPress SEO & Optimisation
 
Introduction to WordPress
Introduction to WordPressIntroduction to WordPress
Introduction to WordPress
 
Developing Locally with WordPress: No More Cowboy Coding
Developing Locally with WordPress: No More Cowboy CodingDeveloping Locally with WordPress: No More Cowboy Coding
Developing Locally with WordPress: No More Cowboy Coding
 
LinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-PresentedLinkedIn SlideShare: Knowledge, Well-Presented
LinkedIn SlideShare: Knowledge, Well-Presented
 

Similar to Introduction to Drupal (7) Theming

Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveAxway Appcelerator
 
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Chris Charlton
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module developmentDamjan Cvetan
 
Crash Course in Theme Surgery
Crash Course in Theme SurgeryCrash Course in Theme Surgery
Crash Course in Theme SurgeryRational Frank
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bagstuplum
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic templatevathur
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingJamie Schmid
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themesakosh
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep diveRomain Jarraud
 
New Adventures in Drupal Theming
New Adventures in Drupal ThemingNew Adventures in Drupal Theming
New Adventures in Drupal ThemingJohn Albin Wilkins
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Aslam Najeebdeen
 
Drupal: an Overview
Drupal: an OverviewDrupal: an Overview
Drupal: an OverviewMatt Weaver
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Mediacurrent
 
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
 
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015Romain Jarraud
 
MCC Web Design Workshop
MCC Web Design WorkshopMCC Web Design Workshop
MCC Web Design WorkshopFaye Tandog
 

Similar to Introduction to Drupal (7) Theming (20)

Ingo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep DiveIngo Muschenetz: Titanium Studio Deep Dive
Ingo Muschenetz: Titanium Studio Deep Dive
 
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...Web Content Management Systems From A Designer's Perspective (Drupal Technica...
Web Content Management Systems From A Designer's Perspective (Drupal Technica...
 
Drupal module development
Drupal module developmentDrupal module development
Drupal module development
 
Crash Course in Theme Surgery
Crash Course in Theme SurgeryCrash Course in Theme Surgery
Crash Course in Theme Surgery
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
How to create a basic template
How to create a basic templateHow to create a basic template
How to create a basic template
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Introduction to Custom WordPress Themeing
Introduction to Custom WordPress ThemeingIntroduction to Custom WordPress Themeing
Introduction to Custom WordPress Themeing
 
Nanocon Taiwan
Nanocon TaiwanNanocon Taiwan
Nanocon Taiwan
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themes
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep dive
 
New Adventures in Drupal Theming
New Adventures in Drupal ThemingNew Adventures in Drupal Theming
New Adventures in Drupal Theming
 
Web Design Bootcamp - Day1
Web Design Bootcamp - Day1Web Design Bootcamp - Day1
Web Design Bootcamp - Day1
 
Efficient theming in Drupal
Efficient theming in DrupalEfficient theming in Drupal
Efficient theming in Drupal
 
Drupal: an Overview
Drupal: an OverviewDrupal: an Overview
Drupal: an Overview
 
Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG) Atlanta Drupal User Group (ADUG)
Atlanta Drupal User Group (ADUG)
 
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 ...
 
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015Drupal8 themingdeepdive drupaldevdays-montpellier17042015
Drupal8 themingdeepdive drupaldevdays-montpellier17042015
 
MCC Web Design Workshop
MCC Web Design WorkshopMCC Web Design Workshop
MCC Web Design Workshop
 

More from Robert Carr

Why I've Not bothered With Drupal 8
Why I've Not bothered With Drupal 8Why I've Not bothered With Drupal 8
Why I've Not bothered With Drupal 8Robert Carr
 
Organic Groups - Overview
Organic Groups - OverviewOrganic Groups - Overview
Organic Groups - OverviewRobert Carr
 
Rhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with DrupalRhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with DrupalRobert Carr
 
Drupal in 30 Minutes
Drupal in 30 MinutesDrupal in 30 Minutes
Drupal in 30 MinutesRobert Carr
 
Drupal Overview For Techies
Drupal Overview For TechiesDrupal Overview For Techies
Drupal Overview For TechiesRobert Carr
 
Gentle Intro to Search Engine Optimisation
Gentle Intro to Search Engine OptimisationGentle Intro to Search Engine Optimisation
Gentle Intro to Search Engine OptimisationRobert Carr
 
Search Engine Optimization & Drupal
Search Engine Optimization & DrupalSearch Engine Optimization & Drupal
Search Engine Optimization & DrupalRobert Carr
 

More from Robert Carr (9)

Why I've Not bothered With Drupal 8
Why I've Not bothered With Drupal 8Why I've Not bothered With Drupal 8
Why I've Not bothered With Drupal 8
 
Organic Groups - Overview
Organic Groups - OverviewOrganic Groups - Overview
Organic Groups - Overview
 
Rhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with DrupalRhetoric and Flexible Content with Drupal
Rhetoric and Flexible Content with Drupal
 
Drupal in 30 Minutes
Drupal in 30 MinutesDrupal in 30 Minutes
Drupal in 30 Minutes
 
Drupal in 5
Drupal in 5Drupal in 5
Drupal in 5
 
Drupal Overview For Techies
Drupal Overview For TechiesDrupal Overview For Techies
Drupal Overview For Techies
 
Gentle Intro to Search Engine Optimisation
Gentle Intro to Search Engine OptimisationGentle Intro to Search Engine Optimisation
Gentle Intro to Search Engine Optimisation
 
Wireframes
WireframesWireframes
Wireframes
 
Search Engine Optimization & Drupal
Search Engine Optimization & DrupalSearch Engine Optimization & Drupal
Search Engine Optimization & Drupal
 

Recently uploaded

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Recently uploaded (20)

UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Introduction to Drupal (7) Theming

  • 1. Theming in Drupal An introduction to theming ! with a little Drupal 7 twist! ! Drupal Camp Edinburgh May 2011! Rob Carr @robertgcarr!
  • 3. Pre-requisites for Theming Adventures HTML.! CSS.! Basics of Drupal.! Some idea of PHP.!
  • 4. ‘Some idea of PHP:’ •  Print variables! •  Logic (if… then)! •  Call functions! For the braver: Arrays and Objects knowledge useful
  • 5. Theming Options Core theme!     Garland! Off the Shelf:! ! •  Contributed (d.o)! Bartik! •  Purchase! ! Scratch (hardcore!)! Seven! Sub-theme! ! ! Stark! Never hack a theme
  • 6. Sub Theme? Select [base] theme.!     Override elements Base theme! you don’t like.! Add custom PHP snippets, HTML, CSS or JS.! Sub theme! (your custom code)" Never hack a theme
  • 7. What is a Theme? A folder full of code:! •  Manifest (.info)" •  Templates (.tpl.php)" •  Styles (.css)" •  Logic (template.php)" •  JavaScript (.js)" " Custom themes live in: /sites/all/themes/ themename
  • 8. Manifest: yourtheme.info ;  DESCRIPTION   Theme description.! name  =  yourtheme   descrip=on  =  A  flexible,  simple  custom  theme  based  on  Bar=k.     ;  REQUIREMENTS   Requirements.! core  =  7.x   base  theme  =  bar=k     ;  STYLESHEETS   Stylesheets.! stylesheets[all][]  =  layout.css   stylesheets[all][]  =  style.css   stylesheets[print][]  =  print.css     Regions.! ;  REGIONS   regions[header]  =  Header   regions[help]  =  Help   Scripts.! regions[page_top]  =  Page  top   regions[page_boSom]  =  Page  boSom   regions[highlighted]  =  Highlighted   regions[naviga=on]  =  Naviga=on   (Features).! regions[content]  =  Content   regions[sidebar_first]  =  Sidebar  first   regions[sidebar_second]  =  Sidebar  second   regions[footer]  =  Footer   (Settings).!   ;  SCRIPTS   scripts[]  =  scripts.js    
  • 9. CSS Cascading Style Sheets – inherit or override!
  • 10. Regions ;  REGIONS   regions[header]  =  Header   regions[help]  =  Help   regions[page_top]  =  Page  top   regions[page_boSom]  =  Page  boSom   regions[highlighted]  =  Highlighted   regions[naviga=on]  =  Naviga=on   regions[content]  =  Content   regions[sidebar_first]  =  Sidebar  first   regions[sidebar_second]  =  Sidebar   second   regions[footer]  =  Footer  
  • 12. Templates html.tpl.php – master region.tpl.php" template; includes <HEAD> content.! field.tpl.php" ! block.tpl.php" page.tpl.php – layout of all <BODY> content.! ! block.tpl.php" node.tpl.php" node.tpl.php – region.tpl.php" individual nodes (pieces region.tpl.php" of content).! page.tpl.php" html.tpl.php"
  • 13. html.tpl.php Theme:  Sky  (HTML5  theme)  
  • 15. Template variables $page – rendered page content – page.tpl.php
  • 17. page.tpl.php variables <?php  if  ($site_slogan):  ?>                      <h2  class="site-­‐slogan"><?php  print  $site_slogan;  ?></h2>   <?php  endif;  ?>   http://api.drupal.org/api/drupal/modules--system--page.tpl.php/7"
  • 18. page.tpl.php regions <?php  print  render($page[region_name]);  ?>   The array $page contains all region content for that particular page"
  • 19. node.tpl.php Renders the content of a node and all its components:! •  Title! •  Main body! •  Author! •  Links (taxonomy etc)! •  Comments!
  • 20. Different Content (node) types Node type:! Template:" •  Article! •  node--article.tpl.php" •  Blog! •  node--blog.tpl.php" •  Event! •  node--event.tpl.php" •  Project! •  node--project.tpl.php" Don’t have to define node.tpl.php to have It’s a -- double nodetype-specific templates
  • 21. Sub Theming - Templates You don’t have to Base theme Your theme define every single html.tpl.php" template if it doesn’t need page.tpl.php" page.tpl.php" changing.! node.tpl.php" node.tpl.php"
  • 22. Templates… and finally You can also create tpl.php files for Views. ! ! Edit View > Advanced > > Information!
  • 23. Templates… and finally You can also create tpl.php files for Views too. ! ! Edit View > Advanced > > Information!
  • 24. Logic Q. Where does the HTML contents of We can override the variables come this HTML output from?! by altering any ! themable function A. theme()! and even add our own variables"
  • 25. theme() 1.  Menu system receives page request.! 2.  Node data built and template applied.! 3.  Node HTML generated.! 4.  Preprocessing to generate HTML for blocks in each region.! 5.  Page template applied.!
  • 27. How Drupal Outputs Breadcrumb Drupal looks for:! 1.  yourtheme_breadcrumb().! 2.  sites/all/themes/yourtheme/breadcrumb.tpl.php! 3.  theme_breadcrumb().! Generates (example):" " Home » contact us"
  • 28. Overide theme_breadcrumb() Example:" Becomes:" " " Home » contact us" Home contact us"
  • 29. A home for our theme function: Any custom theme functions live in:! ! ! sites/all/themes/yourtheme/template.php ! And so much more…!
  • 30. template.php Contains function overrides and can add/ replace template variables for our theme.! ! <theme name>_preprocess_<template name> ! Examples:! yourtheme_preprocess_page(&$vars)" yourtheme_preprocess_html(&$vars)"
  • 31. Add variable example Insert into template.php:! ! ! ! Add to node.tpl.php:! ! ! Clear the cache…!
  • 32. Add variable example Insert into template.php:! ! ! ! Add to node.tpl.php:! ! Clear caches" ! Clear the cache…!
  • 33. Congrats! You’ve now built a theme!! ! But what next: how can I keep tweaking?!
  • 34. Tools Firebug (Plugin for FF, Firebug-Lite for others)! IE Developer!
  • 35. Drupal Functions Drupal API: ! http://api.drupal.org/! ! Contrib Modules API: http://drupalcontrib.org/api/drupal! !
  • 37. The Killer App! Theme Developer Module http://drupal.org/project/devel_themer! ! See also Drupal for Firebug (a bit hardcore)! http://drupal.org/project/drupalforfirebug! !
  • 38. The Killer App! Theme Developer Module http://drupal.org/project/devel_themer! ! See also Drupal for Firebug (a bit hardcore)! http://drupal.org/project/drupalforfirebug! !
  • 39. Top Tip: Never eat yellow snow
  • 40. Top Tip: Clear the caches! Never eat yellow snow /admin/config/development/performance/ (‘Clear all caches’) Or drush cc all "
  • 41. Drupal 6 Well I mastered theming in Drupal 6, but what changed when Drupal 7 was released?! ! Too much to talk about here, but a great list is at:! http://drupal.org/update/themes/6/7!
  • 42. Packt – Drupal 7 Themes Only hard copy book available at time of presentation - published June 2011! !
  • 43. Again! We covered the basics:! •  Theme components ! •  Templates! •  Overriding theme()! •  Tools! •  Reference!
  • 44. FIN

Editor's Notes

  1. Variables:$css: An array of CSS files for the current page.$language: (object) The language the site is being displayed in. $language-&gt;language contains its textual representation. $language-&gt;dir contains the language direction. It will either be &apos;ltr&apos; or &apos;rtl&apos;.$rdf_namespaces: All the RDF namespace prefixes used in the HTML document.$grddl_profile: A GRDDL profile allowing agents to extract the RDF data.$head_title: A modified version of the page title, for use in the TITLE tag.$head_title_array: (array) An associative array containing the string parts that were used to generate the $head_title variable, already prepared to be output as TITLE tag. The key/value pairs may contain one or more of the following, depending on conditions:title: The title of the current page, if any.name: The name of the site.slogan: The slogan of the site, if any, and if there is no title.$head: Markup for the HEAD section (including meta tags, keyword tags, and so on).$styles: Style tags necessary to import all CSS files for the page.$scripts: Script tags necessary to load the JavaScript files and settings for the page.$page_top: Initial markup from any modules that have altered the page. This variable should always be output first, before all other dynamic content.$page: The rendered page content.$page_bottom: Final closing markup from any modules that have altered the page. This variable should always be output last, after all other dynamic content.$classes String of classes that can be used to style contextually through CSS.
  2. General utility variables:$base_path: The base URL path of the Drupal installation. At the very least, this will always default to /.$directory: The directory the template is located in, e.g. modules/system or themes/bartik.$is_front: TRUE if the current page is the front page.$logged_in: TRUE if the user is registered and signed in.$is_admin: TRUE if the user has permission to access administration pages.Site identity:$front_page: The URL of the front page. Use this instead of $base_path, when linking to the front page. This includes the language domain or prefix.$logo: The path to the logo image, as defined in theme configuration.$site_name: The name of the site, empty when display has been disabled in theme settings.$site_slogan: The slogan of the site, empty when display has been disabled in theme settings.Navigation:$main_menu (array): An array containing the Main menu links for the site, if they have been configured.$secondary_menu (array): An array containing the Secondary menu links for the site, if they have been configured.$breadcrumb: The breadcrumb trail for the current page.Page content (in order of occurrence in the default page.tpl.php):$title_prefix (array): An array containing additional output populated by modules, intended to be displayed in front of the main title tag that appears in the template.$title: The page title, for use in the actual HTML content.$title_suffix (array): An array containing additional output populated by modules, intended to be displayed after the main title tag that appears in the template.$messages: HTML for status and error messages. Should be displayed prominently.$tabs (array): Tabs linking to any sub-pages beneath the current page (e.g., the view and edit tabs when displaying a node).$action_links (array): Actions local to the page, such as &apos;Add menu&apos; on the menu administration interface.$feed_icons: A string of all feed icons for the current page.$node: The node object, if there is an automatically-loaded node associated with the page, and the node ID is the second argument in the page&apos;s path (e.g. node/12345 and node/12345/revisions, but not comment/reply/12345).Regions:$page[&apos;help&apos;]: Dynamic help text, mostly for admin pages.$page[&apos;highlighted&apos;]: Items for the highlighted content region.$page[&apos;content&apos;]: The main content of the current page.$page[&apos;sidebar_first&apos;]: Items for the first sidebar.$page[&apos;sidebar_second&apos;]: Items for the second sidebar.$page[&apos;header&apos;]: Items for the header region.$page[&apos;footer&apos;]: Items for the footer region.