SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Building a Drupal Theme

                         Gaurav Khambhala
                     <gaurav@deeproot.co.in>
                       DeepRoot Linux - www.deeproot.in


                               March 22, 2009




Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Introduction




     What is Drupal theme ?
     Drupal theme components
     Try it on your own




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
What is Drupal theme ?




     Drupal theme is a presentation layer to Drupal database.
     Drupal theme is a set of few files, which will work
     together to present the Drupal backend data.




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Theme Files
Following are the few essential files for the drupal theme:
     themename.info
     style.css
     page.tpl.php
     block.tpl.php
     node.tpl.php
     comment.tpl.php
     template.php
     logo.png
We will follow the instruction and create a theme as a by
product of this presentation. Create a theme directory as
named example. In the next couple of slides, we will look into
individual theme files and their contents.
  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
example.info


 example.info description
    A required file in drupal theme.
    Drupal will pick theme name from this file only
    It should be named as your themename.info
    It contains the stylesheets, javascript declarations
    It contains block regions for the theme
    If you want to define some theme level features, you can
    list down in this file




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
example.info content
Content of the example.info file:
    name*
    description
    version
    core*
    engine
    base theme
    stylesheets
    scripts
    regions
    php
    features

  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
example.info content

     name Required. A human readable name of the theme.
            In our case,
             name = Example
description A short description of the theme. This
            description is displayed on the theme select page.
            description = Example drupal theme
   version Version of the theme.
             version = 0.1
      core Required. Version of the drupal core, your theme
            compatible with.
             core = 6.x
    engine The theme engine.
             engine = phptemplate

  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
cont. example.info content


 base theme If you are building a sub theme. It will inherit
            base theme settings.This field is not required
            right now as we are building a new theme.
              sub theme = garland
    regions Set of regions you want to enable for this
            theme.Machine readable values in square brackets
            is the key followed by regions and human readable
            name as a value.

                    regions[region-name] = value




   Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
cont. example.info content
    regions Following are the default regions if no regions
             specified.
             regions[left] = Left sidebar
             regions[right] = Right sidebar
             regions[content] = Content
             regions[header] = Header
             regions[footer] = Footer
stylesheets Stylesheet to use for the theme.
              stylesheets[all][] = style.css
     scripts Javascript files to use for the theme.
              scripts[] = script.js
        php Minimum pHP Version this can support.Not
             required for most of the themes. Can omit this
             settings.
              php = 4.3.3
  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
cont. example.info content

  features You can enable/disable features for the themes.
            features[] = feature-name
           Basically if you don’t specify anything following
           are the default values:
           features[] = logo
           features[] = name
           features[] = slogan
           features[] = mission
           features[] = node_user_picture
           features[] = search
           features[] = favicon
           features[] = primary_links
           features[] = secondary_links

  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
cont. example.info content

Now you have your example.info file ready with the following
content:

name = Example
description = Example drupal theme.
version = VERSION
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css

No need to specify regions and features. Let it be default
values.



  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Theme is ready to use



Now if you copy the example theme directory to your drupal
theme directory. Drupal 6 will detect it from .info file and
ready to be enabled. Go to Administer-Site
Building-Themes.You can see the example theme listed there.

Now we will require to create style.css and php template files
to display the content as we want for this theme.




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Template files



page.tpl.php A main template file that contains the display
            structure of almost all of the pages.
node.tpl.php Defines the node content.
block.tpl.php Defines block content.
comment.tpl.php Defines comment content.
template.php Defines comment content.




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Create template files - page.tpl.php

page.tpl.php file is a combination of html tags as well as
drupal php template variables to show the required
data.Following are some phptemplate variables to use. More
you can find out at http://drupal.org/node/11812
$footer message
             The footer message as defined in the admin
             settings, also the HTML for the footer region.
   $header
             HTML for the header region.
     $logo
             The path to the logo image, as defined in theme
             configuration.


  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Create template files - page.tpl.php



$primary links (array)
            An array containing the links as they have been
            defined in the phptemplate specific configuration
            block.
$sidebar left
            The HTML for the left sidebar.
$sidebar right
            The HTML for the right sidebar.




  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme
Create Theme files

     Download Advanced theme construction kit from
     drupal.org.
     http://ftp.drupal.org/files/projects/atck-6.
     x-6.0.tar.gz
     Untar the downloaded file.atck was developed in a
     production environment for purposes of quickly building
     css and xhtml valid Drupal themes from scratch without
     having to un-theme an existing Drupal theme to do it.
     So you have all the required files for building drupal
     theme. Copy all these files and make required changes to
     .info file.
     Now go to Administer-Site Building-Themes. Enable the
     example theme.

  Gaurav Khambhala <gaurav@deeproot.co.in>   Building a Drupal Theme

Contenu connexe

Tendances

Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechMandakini Kumari
 
Performance on a budget (European Drupal Days 2015)
Performance on a budget (European Drupal Days 2015)  Performance on a budget (European Drupal Days 2015)
Performance on a budget (European Drupal Days 2015) Eugenio Minardi
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to themingBrahampal Singh
 
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
 
Pre process functions in template.php
Pre process functions in template.phpPre process functions in template.php
Pre process functions in template.phpGreen For All
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep diveRomain Jarraud
 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
 
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
 
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
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - LondonMarek Sotak
 
Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceuMarek Sotak
 
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
 
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
Wordpress theme developmentWordpress theme development
Wordpress theme developmentNaeem Junejo
 

Tendances (19)

Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotech
 
Drupal
DrupalDrupal
Drupal
 
Theming and content basics - Drupal Camp CT 2011
Theming and content basics - Drupal Camp CT 2011Theming and content basics - Drupal Camp CT 2011
Theming and content basics - Drupal Camp CT 2011
 
Performance on a budget (European Drupal Days 2015)
Performance on a budget (European Drupal Days 2015)  Performance on a budget (European Drupal Days 2015)
Performance on a budget (European Drupal Days 2015)
 
Drupal 8 introduction to theming
Drupal 8  introduction to themingDrupal 8  introduction to theming
Drupal 8 introduction to theming
 
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
 
Pre process functions in template.php
Pre process functions in template.phpPre process functions in template.php
Pre process functions in template.php
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep dive
 
Word press templates
Word press templatesWord press templates
Word press templates
 
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
 
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
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
D7 theming what's new - London
D7 theming what's new - LondonD7 theming what's new - London
D7 theming what's new - London
 
Theme like a monster #ddceu
Theme like a monster #ddceuTheme like a monster #ddceu
Theme like a monster #ddceu
 
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
 
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
Wordpress theme developmentWordpress theme development
Wordpress theme development
 
Android - Values folder
Android - Values folderAndroid - Values folder
Android - Values folder
 

Similaire à Building Drupal 6 Theme

7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in DrupalWingston
 
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Emma Jane Hogbin Westby
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes ramakesavan
 
Theming tips and tricks
Theming tips and tricksTheming tips and tricks
Theming tips and tricksaaroncouch
 
Drupal Theming for Developers
Drupal Theming for DevelopersDrupal Theming for Developers
Drupal Theming for DevelopersIan Carnaghan
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend developmentsparkfabrik
 
Drupal Theming For Beginners – Danté SELF 2010
Drupal Theming For Beginners – Danté SELF 2010Drupal Theming For Beginners – Danté SELF 2010
Drupal Theming For Beginners – Danté SELF 2010Mediacurrent
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To DrupalLauren Roth
 
Drupal 8 版型開發變革
Drupal 8 版型開發變革Drupal 8 版型開發變革
Drupal 8 版型開發變革Chris Wu
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practicesSynapseindiappsdevelopment
 
Drupal 6 Performance Tips
Drupal 6 Performance TipsDrupal 6 Performance Tips
Drupal 6 Performance TipsTrevor James
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme KickstartPeter
 
Cms drupal installation & configuration anil mishra
Cms drupal installation & configuration   anil mishraCms drupal installation & configuration   anil mishra
Cms drupal installation & configuration anil mishraAnil Mishra
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentsparkfabrik
 

Similaire à Building Drupal 6 Theme (20)

Drupal theme development
Drupal theme developmentDrupal theme development
Drupal theme development
 
7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in Drupal
 
Design to Theme @ CMSExpo
Design to Theme @ CMSExpoDesign to Theme @ CMSExpo
Design to Theme @ CMSExpo
 
Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010Intro to Theming Drupal, FOSSLC Summer Camp 2010
Intro to Theming Drupal, FOSSLC Summer Camp 2010
 
Drupal
DrupalDrupal
Drupal
 
Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes Drupal 7 Theming - Behind the scenes
Drupal 7 Theming - Behind the scenes
 
Theming tips and tricks
Theming tips and tricksTheming tips and tricks
Theming tips and tricks
 
Drupal Theming for Developers
Drupal Theming for DevelopersDrupal Theming for Developers
Drupal Theming for Developers
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
 
Forensic Theming for Drupal
Forensic Theming for DrupalForensic Theming for Drupal
Forensic Theming for Drupal
 
Drupal Theming For Beginners – Danté SELF 2010
Drupal Theming For Beginners – Danté SELF 2010Drupal Theming For Beginners – Danté SELF 2010
Drupal Theming For Beginners – Danté SELF 2010
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
Drupal 8 版型開發變革
Drupal 8 版型開發變革Drupal 8 版型開發變革
Drupal 8 版型開發變革
 
SynapseIndia drupal presentation on drupal best practices
SynapseIndia drupal  presentation on drupal best practicesSynapseIndia drupal  presentation on drupal best practices
SynapseIndia drupal presentation on drupal best practices
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Drupal 6 Performance Tips
Drupal 6 Performance TipsDrupal 6 Performance Tips
Drupal 6 Performance Tips
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme Kickstart
 
Cms drupal installation & configuration anil mishra
Cms drupal installation & configuration   anil mishraCms drupal installation & configuration   anil mishra
Cms drupal installation & configuration anil mishra
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 

Dernier

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Dernier (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Building Drupal 6 Theme

  • 1. Building a Drupal Theme Gaurav Khambhala <gaurav@deeproot.co.in> DeepRoot Linux - www.deeproot.in March 22, 2009 Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 2. Introduction What is Drupal theme ? Drupal theme components Try it on your own Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 3. What is Drupal theme ? Drupal theme is a presentation layer to Drupal database. Drupal theme is a set of few files, which will work together to present the Drupal backend data. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 4. Theme Files Following are the few essential files for the drupal theme: themename.info style.css page.tpl.php block.tpl.php node.tpl.php comment.tpl.php template.php logo.png We will follow the instruction and create a theme as a by product of this presentation. Create a theme directory as named example. In the next couple of slides, we will look into individual theme files and their contents. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 5. example.info example.info description A required file in drupal theme. Drupal will pick theme name from this file only It should be named as your themename.info It contains the stylesheets, javascript declarations It contains block regions for the theme If you want to define some theme level features, you can list down in this file Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 6. example.info content Content of the example.info file: name* description version core* engine base theme stylesheets scripts regions php features Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 7. example.info content name Required. A human readable name of the theme. In our case, name = Example description A short description of the theme. This description is displayed on the theme select page. description = Example drupal theme version Version of the theme. version = 0.1 core Required. Version of the drupal core, your theme compatible with. core = 6.x engine The theme engine. engine = phptemplate Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 8. cont. example.info content base theme If you are building a sub theme. It will inherit base theme settings.This field is not required right now as we are building a new theme. sub theme = garland regions Set of regions you want to enable for this theme.Machine readable values in square brackets is the key followed by regions and human readable name as a value. regions[region-name] = value Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 9. cont. example.info content regions Following are the default regions if no regions specified. regions[left] = Left sidebar regions[right] = Right sidebar regions[content] = Content regions[header] = Header regions[footer] = Footer stylesheets Stylesheet to use for the theme. stylesheets[all][] = style.css scripts Javascript files to use for the theme. scripts[] = script.js php Minimum pHP Version this can support.Not required for most of the themes. Can omit this settings. php = 4.3.3 Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 10. cont. example.info content features You can enable/disable features for the themes. features[] = feature-name Basically if you don’t specify anything following are the default values: features[] = logo features[] = name features[] = slogan features[] = mission features[] = node_user_picture features[] = search features[] = favicon features[] = primary_links features[] = secondary_links Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 11. cont. example.info content Now you have your example.info file ready with the following content: name = Example description = Example drupal theme. version = VERSION core = 6.x engine = phptemplate stylesheets[all][] = style.css No need to specify regions and features. Let it be default values. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 12. Theme is ready to use Now if you copy the example theme directory to your drupal theme directory. Drupal 6 will detect it from .info file and ready to be enabled. Go to Administer-Site Building-Themes.You can see the example theme listed there. Now we will require to create style.css and php template files to display the content as we want for this theme. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 13. Template files page.tpl.php A main template file that contains the display structure of almost all of the pages. node.tpl.php Defines the node content. block.tpl.php Defines block content. comment.tpl.php Defines comment content. template.php Defines comment content. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 14. Create template files - page.tpl.php page.tpl.php file is a combination of html tags as well as drupal php template variables to show the required data.Following are some phptemplate variables to use. More you can find out at http://drupal.org/node/11812 $footer message The footer message as defined in the admin settings, also the HTML for the footer region. $header HTML for the header region. $logo The path to the logo image, as defined in theme configuration. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 15. Create template files - page.tpl.php $primary links (array) An array containing the links as they have been defined in the phptemplate specific configuration block. $sidebar left The HTML for the left sidebar. $sidebar right The HTML for the right sidebar. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme
  • 16. Create Theme files Download Advanced theme construction kit from drupal.org. http://ftp.drupal.org/files/projects/atck-6. x-6.0.tar.gz Untar the downloaded file.atck was developed in a production environment for purposes of quickly building css and xhtml valid Drupal themes from scratch without having to un-theme an existing Drupal theme to do it. So you have all the required files for building drupal theme. Copy all these files and make required changes to .info file. Now go to Administer-Site Building-Themes. Enable the example theme. Gaurav Khambhala <gaurav@deeproot.co.in> Building a Drupal Theme