Book Image

Drupal 6 Themes

By : Ric Shreves
Book Image

Drupal 6 Themes

By: Ric Shreves

Overview of this book

<p>Drupal is an award winning open source Content Management System (CMS). Based on PHP/MySQL, its power and flexibility combined with its exceptional design mean it is one of the most popular choices for creating a CMS website.<br /><br />Drupal employs a specialized templating system and supports themes, which allow you to change the look and feel of the system's front and back-end interfaces. <br /><br />Drupal 6 Themes is an ideal introduction to theming with Drupal 6. If you want to create a striking new look for your Drupal 6 website, this book is for you. This book is a revised, updated and expanded edition of Drupal 5 Themes, written specifically for Drupal 6. The book will show you techniques and tools to help you improve the look and feel of any Drupal 6-powered website<br /><br />Starting from the basics of theme setup and configuration, you will learn about the Drupal theming architecture and the PHPTemplate engine, and then move on to modifying existing themes and building new themes from scratch. You will find out about tools to make your theme development easier, and also find invaluable information about under-documented elements of the theming system.</p>
Table of Contents (16 chapters)
Drupal 6 Themes
Credits
About the Author
About the Reviewers
Preface

Preface

Welcome to Drupal 6 Themes. This book is an updated and expanded version of our Drupal 5 Themes title. Not only has the content been updated to reflect the changes in Drupal 6, but it has also been expanded to include new examples, together with more information and resources.

The goal of this book is to explain the principles behind the Drupal theming system and to provide a reference work for theme developers. The book provides an explanation of the Drupal theme framework and shows how you can use it effectively to manage the presentation of your site. Throughout the text, we illustrate key points by demonstrating practical solutions to common problems.

The book begins with an overview of the default theming system and how you can squeeze the most out of it. In the middle sections, we discuss how to execute more extensive modifications by directly working with Drupal's theme functions and styling. In the latter chapters, we discuss more advanced topics, like how to make the site's presentation layer responsive to the users or the content and how to build templates from scratch.

As the PHPTemplate engine is now so closely integrated with Drupal, we tend to focus on techniques that rely on PHPTemplate. We devote little space to building themes with alternative template engines or directly in PHP. Also, as this work is concerned with the presentation layer of your Drupal site, we do not cover creating new modules or writing custom functionality.

Please note that the author comes from a design background and that many of the explanations and rational reflect the author's background. In that light, this book may not always satisfy hardcore programmers who expect the technical issues to be explained in detail. This book should, however, make the life of many designers a little easier. We also hope that the extensive reference materials included in this book will allow this title to find a lasting home on the shelves of many Drupal developers.

What This Book Covers

Chapter 1 examines the working of the theme system in Drupal, and the different approaches to working with Drupal themes.

Chapter 2 takes a look at all the various theming options that are available in the default Drupal system. By way of example, we take a default theme and customize it using only the options provided by the system.

Chapter 3 will cover how the PHPTemplate theme engine works and how you can use this powerful tool.

Chapter 4 identifies all the themable elements in the Drupal system and tells you where to find the elements together with an explanation of their functions.

Chapter 5 will cover employing of intercepts and overrides to modify the default styling in your Drupal theme.

Chapter 6 takes a look at how to implement extensive modifications to a default Drupal theme. This is a hands-on example of the techniques covered in previous chapters.

Chapter 7 examines how you can build from scratch a new theme employing the PHPTemplate theme engine.

Chapter 8 takes a look at how the Drupal system enables you to vary the styling between sections, pages or users.

Chapter 9 covers the styling of forms in Drupal, one of the more complex areas in the system.

Appendix A is an inventory of the contents of all the stylesheets in the Drupal system.

Appendix B is a listing of tools and extensions that make your work with themes easier and more efficient.

What You Need for This Book

Throughout this book, we will assume that you have the following package installed and available:

  • Drupal CMS (version 6.x)

Who is This Book For

The main requirements of this book are knowledge of HTML, CSS, and a touch of creativity! Though this book aims to make Drupal theming accessible to designers, theming in Drupal 6 involves writing some PHP code, and a basic knowledge of PHP will be helpful.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code will be set as follows:

.title {
color: #666;
font-size: 1.8em;
line-height: 2.0em;
font-style: italic;

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be made bold:

function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' > ', $breadcrumb) .'</div>';
}

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "clicking the Next button moves you to the next screen".

Note

Important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to , making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visit http://www.packtpub.com/files/code/5661_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book. If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide the location address or website name immediately so we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with some aspect of the book, and we will do our best to address it.