SlideShare une entreprise Scribd logo
1  sur  20
DRUPAL THEME
DEVELOPMENT
By
Rajeev Ranjan
INTRODUCTION


Drupal is an open source content management system (CMS)
written in PHP. It is a publishing platform and used to create
blog and enterprise applications. Drupal gives a strong base
for organizing, structuring, creating, developing and managing
web presence. Drupal has standard structure which makes it
easier to access basic functionalities and source code to
anyone who wants to work on it. It comes with multiple user
features which allow creating multiple users and each can be
assigned different roles and permission. Drupal has
thousands of add-on modules and designs which enable to
you to create a unique website that you desire. Its PHP based
platform allows the safe and secure management of websites.


Making a custom Drupal theme is actually quite easy. A Drupal
theme is just a few PHP files, a CSS file, and an info file. I
prefer the PHP template theme engine (the default one) but
you have several choices.



The following information was originally written for Drupal 7.1



Now We will Go to an Overview to how to make a template in
drupal.
DRUPAL TEMPLATE DEVELOPMENT






Navigate to your /themes directory.
You should have a theme there called
/bluemarine. We will use that as an
example.
NOTE: before you edit any files you
will copy the theme to another
directory and rename it. Your custom
themes go in the
directory/sites/all/themes/. Details
about that come later in this tutorial.
Here is a list of the files in the Drupal
6's Bluemarine theme:
THE FILES OF A DRUPAL THEME


bluemarine.info — A required file that is new to Drupal 6
which provides information about the theme.



page.tpl.php — The main template that defines the content
on most of the page.



style.css — The CSS file that sets the CSS rules for the
template.



node.tpl.php — This file defines the content of the nodes.



block.tpl.php — Defines the content of the blocks.
THE FILES OF A DRUPAL THEME








comment.tpl.php — Defines the content of the
comments.
logo.png — Your logo, if you are using one.
screenshot.png — This is a screenshot of your theme
that is used in the admin panel and in the user account
settings if you have enabled more than one theme so
that visitors can choose which theme they want to use.
box.tpl.php — puts a box around things like comments.
See also http://drupal.org/node/11814.
style-rtl.css — this file is new to Drupal 6's Bluemarine.
I think it's a CSS for right to left languages and can be
ignored if you're using a left-to-right language like
English.
PAGE.TPL.PHP AND STYLE.CSS


The page.tpl.php and style.css files are the main files for your
Drupal theme. The page.tpl.php is a mix of HTML and PHP.
Look at the file and notice which snippets of PHP are used
where. For example, the following snippet from the
page.tpl.php file inserts the site's <head> information. Just
copy that snippet into your own custom Drupal template.


The Above code from the Bluemarine page.tpl.php
file use PHP if statements to print out optional
information such as primary links, secondary
links, and site slogan. You control whether those
display in the Drupal control panel. The Bluemarine
template uses tables, but you can easily remove
the tables and make it a 100% CSS-based
template.
THE DRUPAL STYLES.CSS FILE




The style.css file is straightforward. I recommend the Firefox
Web Developer Toolbar for creating the style.css file. Use the
toolbars option Display ID & Class Details in the Information
menu to view the CSS classes and ID's that Drupal is
generating. Then add your own CSS rules to the style.css file.
Other Drupal Theme Files

Other
files
in
the
Drupal
theme
are
block.tpl.php, box.tpl.php, comment.tpl.php, and node.tpl.php.
Each one controls the layout of certain parts of the template.
The comment.tpl.php defines the comment layout as shown
below. It is fairly straightforward PHP: "If there is a user
picture, print the user picture, etc.
YOUR FIRST CUSTOM DRUPAL THEME






Just make a copy of the default Bluemarine template and put it in
your Drupal /sites/all/themes/ directory. That directory doesn't exist
by default, so you should create it if you haven't already. See the
README file in /sites/all/ for more information. Rename the copy of
Bluemarine to the name of your new theme. Enable the new theme.
NOTE: In Drupal 6 there are also theme info files. To change the
name of the theme you'll also need to change the name in the
bluemarine.info file:

Then strip most of the HTML out of the page.tpl.php file and replace
it with the HTML that you would like for your theme. Leave the PHP,
modifying it as desired. If you are using Linux for Web development,
you can use Quanta Plus as an editor to edit your template files
directly on the server. Each time you save the file in Quanta Plus, the
remote copy of the file will be updated.


Use the Firefox Web Developer Toolbar's Display ID & Class
Details feature to view CSS information on your new template
that you are viewing the the browser. Either start a new
style.css file from scratch, or modify the existing one to get the
template the way you would like. To edit the display of
blocks,
nodes,
and
comments,
edit
the
block.tpl.php, node.tpl.php, and comment.tpl.php files
respectively.



When you are finished with your template, take a screenshot
and resize it to about 150x90 pixels. Upload it to your theme
directory as screenshot.png.
DRUPAL TEMPLATE VARIABLES


The PHP snippets in the examples above are just printing
PHPtemplate variables. A complete list of available PHPtemplate
variables that you can use in your template can be found on
Drupal.org's PHPtemplate variables page. Below are the
available variables



$breadcrumb- HTML for displaying the breadcrumbs at the top of
the page.



$closure- Needs to be displayed at the bottom of the page, for any
dynamic javascript that needs to be called once the page has already
been displayed.



$content- The HTML content generated by Drupal to be displayed.



$directoryThe
directory
the
theme
is
located
, e.g.themes/box_grey or themes/box_grey/box_cleanslate.



$footer_message- The footer message as defined in the admin
settings.

in


$head- HTML as generated by drupal_get_html_head().



$head_title- The text to be displayed in the page title.



$help- Dynamic help text, mostly for admin pages.



$is_front- True if the front page is currently being displayed.
Used to toggle the mission.



$language- The language the site is being displayed in.



$layout-This setting allows you to style different types of
layout ('none', 'left', 'right' or 'both') differently, depending on
how many sidebars are enabled.


$logo- The path to the logo image, as defined in theme
configuration.



$messages- HTML for status and error messages, to be
displayed at the top of the page.



$mission- The text of the site mission.



$node- (5.x and after only)If you are in page.tpl.php displaying
a node in full page view then $node is available to your
template.



$onload_attribute-(4.7 and older only) Onload tags to be
added to the head tag, to allow for autoexecution of attached
scripts.


$primary links (array)- An array containing the links as they
have been defined in the php template specific configuration
block.



$scripts- (5.x and after only) HTML to load the JavaScript
files and make the JS settings available. Previously,
JavaScript files are hardcoded into the page.tpl.php



$search box- True(1) if the search box has been enabled.



$search_button_text- (4.7 and older only)Translated text on
the search button.



$search description-(4.7 and
description for the search button.

older

only)Translated


$search_url-(4.7 and older only)URL the search form is
submitted to.



$secondary_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.



$site- The name of the site, always filled in.


$site name- The site name of the site, to be used in the
header, empty when display has been disabled.



$site slogan- The slogan of the site, empty when display has
been disabled.



$styles- Required for style sheet switching to work. This prints
out the style tags required.



$tabs- HTML for displaying tabs at the top of the page.



$title- Title, different from head title, as this is just the node title
most of the time.



There are also other variables available for your Drupal
theme.
Drupal Theme Development

Contenu connexe

Tendances

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
 
Demystifying drupal 7 theming
Demystifying drupal 7 themingDemystifying drupal 7 theming
Demystifying drupal 7 themingAnthony Ogbonna
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Themecertainstrings
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep diveRomain Jarraud
 
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
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Themecertainstrings
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designerselliotjaystocks
 
Word press templates
Word press templatesWord press templates
Word press templatesDan Phiffer
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress ThemesLaura Hartwig
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentSitdhibong Laokok
 
Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelChris Albrecht
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3David Bisset
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magentohainutemicute
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's newMarek Sotak
 
Customizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceCustomizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceBharat Chaudhari
 
Drupal 6x Installation
Drupal 6x Installation Drupal 6x Installation
Drupal 6x Installation Micky Metts
 

Tendances (20)

Building Drupal 6 Theme
Building Drupal 6 ThemeBuilding Drupal 6 Theme
Building Drupal 6 Theme
 
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
 
Demystifying drupal 7 theming
Demystifying drupal 7 themingDemystifying drupal 7 theming
Demystifying drupal 7 theming
 
Drupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating ModulesDrupal - Introduction to Drupal Creating Modules
Drupal - Introduction to Drupal Creating Modules
 
A look at Drupal 7 Theming
A look at Drupal 7 ThemingA look at Drupal 7 Theming
A look at Drupal 7 Theming
 
Arizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress ThemeArizona WP - Building a WordPress Theme
Arizona WP - Building a WordPress Theme
 
Drupal 8 theming deep dive
Drupal 8 theming deep diveDrupal 8 theming deep dive
Drupal 8 theming deep dive
 
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
 
Wordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob LarsenWordpress & HTML5 by Rob Larsen
Wordpress & HTML5 by Rob Larsen
 
Builing a WordPress Theme
Builing a WordPress ThemeBuiling a WordPress Theme
Builing a WordPress Theme
 
WordPress Theme Development for Designers
WordPress Theme Development for DesignersWordPress Theme Development for Designers
WordPress Theme Development for Designers
 
Word press templates
Word press templatesWord press templates
Word press templates
 
Customizing WordPress Themes
Customizing WordPress ThemesCustomizing WordPress Themes
Customizing WordPress Themes
 
Introduction to WordPress Theme Development
Introduction to WordPress Theme DevelopmentIntroduction to WordPress Theme Development
Introduction to WordPress Theme Development
 
Theming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and FeelTheming Drupal: Beyond the Look and Feel
Theming Drupal: Beyond the Look and Feel
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
Designing for magento
Designing for magentoDesigning for magento
Designing for magento
 
Drupal 7 Theming - what's new
Drupal 7 Theming - what's newDrupal 7 Theming - what's new
Drupal 7 Theming - what's new
 
Customizing the look and-feel of DSpace
Customizing the look and-feel of DSpaceCustomizing the look and-feel of DSpace
Customizing the look and-feel of DSpace
 
Drupal 6x Installation
Drupal 6x Installation Drupal 6x Installation
Drupal 6x Installation
 

En vedette (18)

Film opening halloween
Film opening   halloweenFilm opening   halloween
Film opening halloween
 
Evaluation Task 4
Evaluation Task 4Evaluation Task 4
Evaluation Task 4
 
BLM, 5 photos pour 1 défi!
BLM, 5 photos pour 1 défi!BLM, 5 photos pour 1 défi!
BLM, 5 photos pour 1 défi!
 
On page Optimization
On page OptimizationOn page Optimization
On page Optimization
 
Music Video Analysis
Music Video AnalysisMusic Video Analysis
Music Video Analysis
 
Survey monkey results
Survey monkey resultsSurvey monkey results
Survey monkey results
 
Mood board for digipak
Mood board for digipakMood board for digipak
Mood board for digipak
 
Film opening - Scream
Film opening - ScreamFilm opening - Scream
Film opening - Scream
 
Film opening - Halloween
Film opening - HalloweenFilm opening - Halloween
Film opening - Halloween
 
Social networks
Social networksSocial networks
Social networks
 
Things around me
Things around meThings around me
Things around me
 
Film opening - 21 Jump Street
Film opening - 21 Jump StreetFilm opening - 21 Jump Street
Film opening - 21 Jump Street
 
Humming Bird Update
Humming Bird UpdateHumming Bird Update
Humming Bird Update
 
Search Engine Optimization
Search Engine OptimizationSearch Engine Optimization
Search Engine Optimization
 
Rpt matematik t4 2013
Rpt matematik t4 2013Rpt matematik t4 2013
Rpt matematik t4 2013
 
Lets talk about Planet Mars
Lets talk about Planet MarsLets talk about Planet Mars
Lets talk about Planet Mars
 
Kittens & &lt;asdfj> ""
Kittens & &lt;asdfj> ""Kittens & &lt;asdfj> ""
Kittens & &lt;asdfj> ""
 
Introduksyon sa pananaliksik wika at panitikan
Introduksyon sa pananaliksik wika at panitikanIntroduksyon sa pananaliksik wika at panitikan
Introduksyon sa pananaliksik wika at panitikan
 

Similaire à Drupal Theme Development

7 Theming in Drupal
7 Theming in Drupal7 Theming in Drupal
7 Theming in DrupalWingston
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To DrupalLauren Roth
 
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
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsDrupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsMicky Metts
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 OverviewRyan Cross
 
Creating and Theming Custom Content Types
Creating and Theming Custom Content TypesCreating and Theming Custom Content Types
Creating and Theming Custom Content Typesheatherrumd
 
Drupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritenceDrupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritenceAimee Maree Forsstrom
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentsparkfabrik
 
Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechMandakini Kumari
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themesakosh
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeMediacurrent
 

Similaire à Drupal Theme Development (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
 
Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Drupal
DrupalDrupal
Drupal
 
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 ...
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal ConceptsDrupal 7x Installation - Introduction to Drupal Concepts
Drupal 7x Installation - Introduction to Drupal Concepts
 
Drupal 6 Overview
Drupal 6 OverviewDrupal 6 Overview
Drupal 6 Overview
 
Drupal Theming
Drupal Theming Drupal Theming
Drupal Theming
 
Creating and Theming Custom Content Types
Creating and Theming Custom Content TypesCreating and Theming Custom Content Types
Creating and Theming Custom Content Types
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
Drupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritenceDrupal7 themeing changes and inheritence
Drupal7 themeing changes and inheritence
 
Readme
ReadmeReadme
Readme
 
Drupal 8 - Corso frontend development
Drupal 8 - Corso frontend developmentDrupal 8 - Corso frontend development
Drupal 8 - Corso frontend development
 
Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotech
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 
Design to Theme @ CMSExpo
Design to Theme @ CMSExpoDesign to Theme @ CMSExpo
Design to Theme @ CMSExpo
 
Drupal Themes
Drupal ThemesDrupal Themes
Drupal Themes
 
Drupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-ThemeDrupalcamp Atlanta 2010 Design-to-Theme
Drupalcamp Atlanta 2010 Design-to-Theme
 
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
 

Dernier

8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCRashishs7044
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCRashishs7044
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Seta Wicaksana
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...ssuserf63bd7
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...ShrutiBose4
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfpollardmorgan
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607dollysharma2066
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024Matteo Carbone
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607dollysharma2066
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?Olivia Kresic
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesKeppelCorporation
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menzaictsugar
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailAriel592675
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Kirill Klimov
 
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCRashishs7044
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 

Dernier (20)

8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
8447779800, Low rate Call girls in Shivaji Enclave Delhi NCR
 
8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR8447779800, Low rate Call girls in Saket Delhi NCR
8447779800, Low rate Call girls in Saket Delhi NCR
 
Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...Ten Organizational Design Models to align structure and operations to busines...
Ten Organizational Design Models to align structure and operations to busines...
 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...
 
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
Ms Motilal Padampat Sugar Mills vs. State of Uttar Pradesh & Ors. - A Milesto...
 
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdfIntro to BCG's Carbon Emissions Benchmark_vF.pdf
Intro to BCG's Carbon Emissions Benchmark_vF.pdf
 
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607FULL ENJOY Call girls in Paharganj Delhi | 8377087607
FULL ENJOY Call girls in Paharganj Delhi | 8377087607
 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
 
IoT Insurance Observatory: summary 2024
IoT Insurance Observatory:  summary 2024IoT Insurance Observatory:  summary 2024
IoT Insurance Observatory: summary 2024
 
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
(Best) ENJOY Call Girls in Faridabad Ex | 8377087607
 
MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?MAHA Global and IPR: Do Actions Speak Louder Than Words?
MAHA Global and IPR: Do Actions Speak Louder Than Words?
 
Annual General Meeting Presentation Slides
Annual General Meeting Presentation SlidesAnnual General Meeting Presentation Slides
Annual General Meeting Presentation Slides
 
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu MenzaYouth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
Youth Involvement in an Innovative Coconut Value Chain by Mwalimu Menza
 
Corporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information TechnologyCorporate Profile 47Billion Information Technology
Corporate Profile 47Billion Information Technology
 
Case study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detailCase study on tata clothing brand zudio in detail
Case study on tata clothing brand zudio in detail
 
Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024Flow Your Strategy at Flight Levels Day 2024
Flow Your Strategy at Flight Levels Day 2024
 
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
No-1 Call Girls In Goa 93193 VIP 73153 Escort service In North Goa Panaji, Ca...
 
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR8447779800, Low rate Call girls in Tughlakabad Delhi NCR
8447779800, Low rate Call girls in Tughlakabad Delhi NCR
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 

Drupal Theme Development

  • 2. INTRODUCTION  Drupal is an open source content management system (CMS) written in PHP. It is a publishing platform and used to create blog and enterprise applications. Drupal gives a strong base for organizing, structuring, creating, developing and managing web presence. Drupal has standard structure which makes it easier to access basic functionalities and source code to anyone who wants to work on it. It comes with multiple user features which allow creating multiple users and each can be assigned different roles and permission. Drupal has thousands of add-on modules and designs which enable to you to create a unique website that you desire. Its PHP based platform allows the safe and secure management of websites.
  • 3.  Making a custom Drupal theme is actually quite easy. A Drupal theme is just a few PHP files, a CSS file, and an info file. I prefer the PHP template theme engine (the default one) but you have several choices.  The following information was originally written for Drupal 7.1  Now We will Go to an Overview to how to make a template in drupal.
  • 4. DRUPAL TEMPLATE DEVELOPMENT    Navigate to your /themes directory. You should have a theme there called /bluemarine. We will use that as an example. NOTE: before you edit any files you will copy the theme to another directory and rename it. Your custom themes go in the directory/sites/all/themes/. Details about that come later in this tutorial. Here is a list of the files in the Drupal 6's Bluemarine theme:
  • 5. THE FILES OF A DRUPAL THEME  bluemarine.info — A required file that is new to Drupal 6 which provides information about the theme.  page.tpl.php — The main template that defines the content on most of the page.  style.css — The CSS file that sets the CSS rules for the template.  node.tpl.php — This file defines the content of the nodes.  block.tpl.php — Defines the content of the blocks.
  • 6. THE FILES OF A DRUPAL THEME      comment.tpl.php — Defines the content of the comments. logo.png — Your logo, if you are using one. screenshot.png — This is a screenshot of your theme that is used in the admin panel and in the user account settings if you have enabled more than one theme so that visitors can choose which theme they want to use. box.tpl.php — puts a box around things like comments. See also http://drupal.org/node/11814. style-rtl.css — this file is new to Drupal 6's Bluemarine. I think it's a CSS for right to left languages and can be ignored if you're using a left-to-right language like English.
  • 7. PAGE.TPL.PHP AND STYLE.CSS  The page.tpl.php and style.css files are the main files for your Drupal theme. The page.tpl.php is a mix of HTML and PHP. Look at the file and notice which snippets of PHP are used where. For example, the following snippet from the page.tpl.php file inserts the site's <head> information. Just copy that snippet into your own custom Drupal template.
  • 8.
  • 9.  The Above code from the Bluemarine page.tpl.php file use PHP if statements to print out optional information such as primary links, secondary links, and site slogan. You control whether those display in the Drupal control panel. The Bluemarine template uses tables, but you can easily remove the tables and make it a 100% CSS-based template.
  • 10. THE DRUPAL STYLES.CSS FILE   The style.css file is straightforward. I recommend the Firefox Web Developer Toolbar for creating the style.css file. Use the toolbars option Display ID & Class Details in the Information menu to view the CSS classes and ID's that Drupal is generating. Then add your own CSS rules to the style.css file. Other Drupal Theme Files Other files in the Drupal theme are block.tpl.php, box.tpl.php, comment.tpl.php, and node.tpl.php. Each one controls the layout of certain parts of the template. The comment.tpl.php defines the comment layout as shown below. It is fairly straightforward PHP: "If there is a user picture, print the user picture, etc.
  • 11.
  • 12. YOUR FIRST CUSTOM DRUPAL THEME    Just make a copy of the default Bluemarine template and put it in your Drupal /sites/all/themes/ directory. That directory doesn't exist by default, so you should create it if you haven't already. See the README file in /sites/all/ for more information. Rename the copy of Bluemarine to the name of your new theme. Enable the new theme. NOTE: In Drupal 6 there are also theme info files. To change the name of the theme you'll also need to change the name in the bluemarine.info file: Then strip most of the HTML out of the page.tpl.php file and replace it with the HTML that you would like for your theme. Leave the PHP, modifying it as desired. If you are using Linux for Web development, you can use Quanta Plus as an editor to edit your template files directly on the server. Each time you save the file in Quanta Plus, the remote copy of the file will be updated.
  • 13.  Use the Firefox Web Developer Toolbar's Display ID & Class Details feature to view CSS information on your new template that you are viewing the the browser. Either start a new style.css file from scratch, or modify the existing one to get the template the way you would like. To edit the display of blocks, nodes, and comments, edit the block.tpl.php, node.tpl.php, and comment.tpl.php files respectively.  When you are finished with your template, take a screenshot and resize it to about 150x90 pixels. Upload it to your theme directory as screenshot.png.
  • 14. DRUPAL TEMPLATE VARIABLES  The PHP snippets in the examples above are just printing PHPtemplate variables. A complete list of available PHPtemplate variables that you can use in your template can be found on Drupal.org's PHPtemplate variables page. Below are the available variables  $breadcrumb- HTML for displaying the breadcrumbs at the top of the page.  $closure- Needs to be displayed at the bottom of the page, for any dynamic javascript that needs to be called once the page has already been displayed.  $content- The HTML content generated by Drupal to be displayed.  $directoryThe directory the theme is located , e.g.themes/box_grey or themes/box_grey/box_cleanslate.  $footer_message- The footer message as defined in the admin settings. in
  • 15.  $head- HTML as generated by drupal_get_html_head().  $head_title- The text to be displayed in the page title.  $help- Dynamic help text, mostly for admin pages.  $is_front- True if the front page is currently being displayed. Used to toggle the mission.  $language- The language the site is being displayed in.  $layout-This setting allows you to style different types of layout ('none', 'left', 'right' or 'both') differently, depending on how many sidebars are enabled.
  • 16.  $logo- The path to the logo image, as defined in theme configuration.  $messages- HTML for status and error messages, to be displayed at the top of the page.  $mission- The text of the site mission.  $node- (5.x and after only)If you are in page.tpl.php displaying a node in full page view then $node is available to your template.  $onload_attribute-(4.7 and older only) Onload tags to be added to the head tag, to allow for autoexecution of attached scripts.
  • 17.  $primary links (array)- An array containing the links as they have been defined in the php template specific configuration block.  $scripts- (5.x and after only) HTML to load the JavaScript files and make the JS settings available. Previously, JavaScript files are hardcoded into the page.tpl.php  $search box- True(1) if the search box has been enabled.  $search_button_text- (4.7 and older only)Translated text on the search button.  $search description-(4.7 and description for the search button. older only)Translated
  • 18.  $search_url-(4.7 and older only)URL the search form is submitted to.  $secondary_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.  $site- The name of the site, always filled in.
  • 19.  $site name- The site name of the site, to be used in the header, empty when display has been disabled.  $site slogan- The slogan of the site, empty when display has been disabled.  $styles- Required for style sheet switching to work. This prints out the style tags required.  $tabs- HTML for displaying tabs at the top of the page.  $title- Title, different from head title, as this is just the node title most of the time.  There are also other variables available for your Drupal theme.