Drupal 5 Themes: Create a new theme for your Drupal website with a clean layout and powerful CSS styling
www.PACKTPUB.com  FREE ONLINE EDITION: Read full chapters online, download free samples from the book and more...
Book Contents Index > Chapter 7

Preface

1: The Elements of a Drupal Theme
2: Theme Set Up and Configuration
3: Working with Theme Engines Free Chapter
4: Style Sheets and Themeable Functions
5: Intercepts and Overrides
6: Modifying an Existing Theme
7: Building a New Theme
8:
Dealing with Forms

Appendix A


Index

Free Chapter:
Chapter 3: Working with Theme Engines [2.1 MB]

Contact us

Chapter 7: Building a New Theme

This chapter takes us into the world of building Drupal themes from scratch. While many people may begin their theme project by copying and modifying an existing theme, in this chapter, we cater to the purists who want to do it all themselves.

Inside we'll cover the basics of creating a new theme employing the PHPTemplate engine, and step through the various tasks required to produce a fully functional theme. In the last half of the chapter, we cover some of the more advanced techniques, including working with theme variables, employing multiple templates, and dynamic theming.

We close this chapter with a brief look at creating a pure PHP template, that is, theming Drupal without the use of a theme engine.

To follow fully the examples in this chapter, you will need your favorite web editor (Dreamweaver or another similar program) and, preferably, access to a development server on which to preview your work. In the section dealing with pure PHP themes, we will be using as our example the Chameleon theme from the default Drupal distro.

Chapter 7: Building a New Theme

  • Planning the Build
  • Build a New PHPTemplate Theme
    • Building a page.tpl.php File
      • Insert DocType and Head
      • Insert Body Tags
      • Lay Out the Page Divisions
      • Place the Functional Elements
      • The Final page.tpl.php File
    • The style.css File
    • A Look at Our New Theme
  • Extending Your PHPTemplate Theme
    • Working with Template Variables
      • Variables Available in block.tpl.php
      • Variables Available in box.tpl.php
      • Variables Available in comment.tpl.php
      • Variables Available in node.tpl.php
      • Variables Available in page.tpl.php
      • Intercepting and Overriding Variables
      • Making New Variables Available
    • Dynamic Theming
      • Using Multiple Templates
      • Dynamically Theming Page Elements
      • Creating Dynamic CSS Styling
  • Build a New Pure PHP Theme
    • Required Elements
    • HTML Headers
    • Head of Document
    • Implementing the Features
      • Favicon
      • Logo
      • Site Name
      • Site Slogan
    • Primary and Secondary Links
    • Sidebars
      • Sidebar Left
      • Sidebar Right
    • Main Content Area
      • Title and Breadcrumb Trail
      • Tabs
      • Help
      • Messages
      • Content Region
    • Footer
    • Theme Closure
    • Overriding Functions
  • Summary

 

   

 

Paperback 250 pages
Released: December 2007
ISBN: 1847191827
ISBN 13:
978-1-847191-82-3

     

 




View the book details
on PacktPub.com

 


 
  This website is owned and maintained by Packt Publishing Ltd, 2008. All rights reserved. Terms and Conditions