Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Drupal 5 Themes
Drupal 5 Themes

Drupal 5 Themes: Create a new theme for your Drupal website with a clean layout and powerful CSS styling

eBook
€8.99 €25.99
Paperback
€32.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Drupal 5 Themes

Chapter 2. Theme Set Up and Configuration

The large and active community of developers that has formed around Drupal guarantees a steady flow of themes for this popular CMS. The diversity of that community also assures that there will be a wide variety of themes produced. Add into the equation the existence of a growing number of commercial and open source web designs and you can be certain that somewhere out there is a design that is close to what you want. The issue becomes identifying the sources of themes and designs, and determining how much work you want to do yourself.

You can find both design ideas and complete themes on the Web. You need to decide whether you want to work with an existing theme, or convert a design into a theme, or whether you want to start from scratch, unburdened by any preliminary constraints or alien code. For purposes of this chapter, we will be dealing with finding, installing, and configuring an existing and current Drupal theme. In later chapters, we will...

Finding Additional Themes


There are several factors to consider when determining the suitability of an existing theme.

The first issue is compatibility. Due to changes made to Drupal in the 5.x series, older themes will not work properly with Drupal 5.x. Accordingly, your first step is to determine which version of Drupal you are running.

To find the version information for your installation, go to Administer | Logs | Status Report. The first line of the Status Report tabular data will show your version number.

The Status Report screen showing Drupal version number. Note also this screen includes other useful information, like your MySQL and PHP version numbers

Note

If you do not see the Status Report option, then you are probably using a Drupal version earlier than 5.x. We suggest you upgrade as this book is for Drupal 5.x.

If you know your Drupal version, you can confirm whether the theme you are considering is usable on your system. If the theme you are looking at doesn't provide versioning...

Installing an Additional Theme


Theme installation requires that you have the ability to move files from your local machine on to your server. Typically, this is done with an FTP client or through your hosting control panel file manager. The method you use is up to you, both have their advantages. It makes no difference to Drupal which method you choose to employ.

Odds are your theme was delivered to you as a single file containing a compressed archive of files. When I downloaded Gagarin, above, I wound up with the file gagarin-5.x-1.x-dev.tar.gz. The .tar.gz format (a.k.a. "tarball") is one of several commonly used to create compressed archives.

The first step towards getting the theme installed is to locally uncompress the archive. Double click the tarball and one of two things will happen: Either the file will uncompress and leave you with a new folder name "gagarin" or your system will prompt you to look for an application to open this file type. In the latter case, you will need to...

Configuring a Theme


In this section, we're going to go through the system and highlight the configuration options that are part of the default Drupal distro. We're not going to install any additional extensions or modify any code—we're going to focus exclusively on what can be done straight out of the box. We'll then apply this knowledge with an example configuration of the Garland default theme in the section that follows this one.

To begin, navigate to the theme manager (Administer | Site building | Themes). Access the configuration options of the Garland theme by clicking the configure link in the right hand column.

The Garland theme as it appears in the Theme Manager. The configure link is in the right hand column

The Theme Configuration screen provides access to both global configuration and theme-specific configuration settings. As the name implies, global configuration is used to apply configuration choices consistently site wide—even across multiple themes. The theme specific configuration...

Managing Modules and Blocks


Modules are plug-ins which extend the functionality of the Drupal core. The Modules you select to use and the positioning of their output (Blocks) on the page can affect greatly the look and feel of your site. Managing effectively the various Modules and Blocks is a key to controlling the user experience on your site.

The standard Drupal distro includes a number of modules, only some of which are active in the default configuration. You can enable additional modules or disable some of the optional ones to achieve the functionality you desire.

Note

A variety of modules can be found on the official Drupal site at http://drupal.org/project/Modules

The Module Manager

The Module Manager (Administer|Site building|Modules) includes a list of all available installed Modules. The default modules are categorized as Core optional and Core required. As you add additional modules to your installation, other group names may appear.

The Modules Manager

To enable a Module, simply...

Theming in Action: Dressing Up Garland


Now, just for the sake of practice, let's take what's been covered in this chapter and apply it to the tailoring an existing theme. We'll start with a default theme and apply the various options available in the system in an effort to create a uniquely tailored theme.

For purposes of the following example, our hypothetical client is Fluid Carbon, a fan site for Italian sports cars. This is a hobbyist's site, so the owner has a very limited budget and doesn't want to pay for custom design work or custom component development; the budget restrictions basically force us to work with Drupal straight out of the box.

Here are the client's requirements…

Look & Feel

  • Fluid 3 column layout

  • Color scheme to match existing client I.D.

  • Must use client's logo in header

  • Wants clean look—not too much clutter

  • Vertical main nav, in the right column

Functionality

  • Blog for site editor (only one blog)

  • Forums (only one needed)

  • Ability to display third party RSS feed content

  • Polls...

Uninstalling Themes


Uninstalling themes is a simple process, essentially the reverse of installing. First go to the Theme Manager and make sure that the theme you wish to install is not currently enabled. Once you have verified that it is disabled, then access your server. On the server, find the directory containing the theme files and delete the files and the directory. That's all there is to it!

Note that Drupal is very forgiving, and erroneous deletion of an active theme will not crash your site, it will simply result in the content being shown without any styling.

Summary


We started this chapter looking at how to find and install themes and we ended by trying to extract as much as we could from the default system. Given the flexibility of the system it is perhaps not surprising that a number of people work exclusively from the default themes. The Fluid Carbon example in this chapter shows that you can extract quite a bit from the basic set up.

As you will see in the chapters ahead, the techniques we covered in this chapter are just the beginning of what you can do with Drupal themes. Nonetheless, the configuration principles in this chapter, particularly as they relate to the use of Modules and Blocks and the control of visibility settings, are important for all theme work. We will come back to some of these points when we get more into heavy customization and building custom themes, in the chapters that follow.

Left arrow icon Right arrow icon

Key benefits

  • Learn to create new Drupal 5 Themes
  • No experience of Drupal 5 theming required
  • Set up and configure themes
  • Understand Drupal 5's themeable functions

Description

Drupal is an award winning open source Content Management System. Based on PHP/MySQL, its power and flexibility combined with its exceptional design mean it is already on the way to becoming the de facto standard for CMS Websites. Drupal?¢‚Ǩ‚Ñ¢s modular design and structured source code make it both highly flexible and easily extended and modified. Drupal is extremely scalable, making it ideal for both a simple personal website as well as an industrial strength commercial or institutional web presence.Drupal is a model open source project in that it has a large, friendly community of people who contribute to the project in various ways. Drupal is not only free and easy to use, but this community provides on going mutual support.

Who is this book for?

This book is the ideal introduction to theming with Drupal 5. If you want to create a striking new look for your Drupal website, this book is for you. 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. Included is a complete guide to the various style sheets and themeable functions in Drupal 5, making this book a valuable resource even to experienced theme developers. It covers: Creating custom templates Basics of theming in pure PHP Modifying an existing PHPTemplate theme' a step-by-step guide Creating a new PHPTemplate theme' a step-by-step guide Working with forms The main requirements to make use of this book are knowledge of HTML, CSS, and a touch of creativity! Although this book aims to make Drupal theming accessible to designers, theming in Drupal 5 involves writing some PHP code, and a basic knowledge of PHP will be helpful.

What you will learn

  • This book is the ideal introduction to theming with Drupal 5. If you want to create a striking new look for your Drupal website, this book is for you. 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. Included is a complete guide to the various style sheets and themeable functions in Drupal 5, making this book a valuable resource even to experienced theme developers. It covers:
  • Creating custom templates
  • Basics of theming in pure PHP
  • Modifying an existing PHPTemplate theme?¢‚Ǩ‚Äù a step-by-step guide
  • Creating a new PHPTemplate theme?¢‚Ǩ‚Äùa step-by-step guide
  • Working with forms
  • The main requirements to make use of this book are knowledge of HTML, CSS, and a touch of creativity! Although this book aims to make Drupal theming accessible to designers, theming in Drupal 5 involves writing some PHP code, and a basic knowledge of PHP will be helpful.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 31, 2007
Length: 260 pages
Edition : 1st
Language : English
ISBN-13 : 9781847191830
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 31, 2007
Length: 260 pages
Edition : 1st
Language : English
ISBN-13 : 9781847191830
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 108.97
Drupal 7 Social Networking
€37.99
Drupal 6 Theming Cookbook
€37.99
Drupal 5 Themes
€32.99
Total 108.97 Stars icon
Banner background image

Table of Contents

8 Chapters
The Elements of a Drupal Theme Chevron down icon Chevron up icon
Theme Set Up and Configuration Chevron down icon Chevron up icon
Working with Theme Engines Chevron down icon Chevron up icon
Style Sheets and Themeable Functions Chevron down icon Chevron up icon
Intercepts and Overrides Chevron down icon Chevron up icon
Modifying an Existing Theme Chevron down icon Chevron up icon
Building a New Theme Chevron down icon Chevron up icon
Dealing with Forms Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(12 Ratings)
5 star 33.3%
4 star 50%
3 star 16.7%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




E. Langhout May 05, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book for web-designers/developers who start with Drupal 6 Themes. Can't wait for the Drupal 6 version or a book that addresses the more experienced Drupal Developers.
Amazon Verified review Amazon
Alan Doucette Jan 20, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you are a designer wanting to learn Drupal, this book is for you. It is written by a designer so there are no programming sections full of code. It shows you how you can customize Drupal's HTML and CSS in detail. The book has a good amount of screen shots, charts, and other visual aids that really help the right side of the brain.The first 2 chapters are great setup chapters, so if you are new to Drupal they help you get started by telling many of the things designers need to know. There were several "ah ha" moments where concepts finally clicked because of the author's descriptions and examples.This is also a great reference book. It lists all the CSS files and theme functions that come in Drupal core with a short sentence on their content or purpose. There is an appendix that charts out all the Drupal core CSS files giving you a visual lookup of all ID's and classes for each CSS file.As I am not new to Drupal the organization was a little strange at first. Topics like overriding template files is covered a few times in first half with little detail. But after finishing the book the organization is more clear. The author spends time going over all the areas of Drupal theming to give you a good background then spends a few chapters modding an existing template and creating one from scratch where he goes into more detail.The last chapter covers Drupal forms which could do with a book of their own almost. But the author covered a lot of good material to get you started."Drupal 5 Theming" doesn't cover CCK or Views theming. CCK and Views are contributed modules that almost every Drupal 5 site uses. It also doesn't cover any advanced theming topics. Which makes this book GREAT for the Druapl beginner, GOOD for intermediates, and FAIR for advanced themers.Also with Drupal 6 almost here, if you are worried this book will be out of date, don't. There are several theming advances in D6 but the background and understanding this book gives you still applies. Plus D5 is here for the foreseeable future so if you are working on a project now, it will make your job a lot easier.
Amazon Verified review Amazon
Sun Moon Stars Feb 28, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm extremely impressed with Drupal 5 Themes. I received this book just after finishing coding three custom themes for clients - so Drupal themeing was definitely on my brain! The book is written for non-technical designers, not programmers. However, experienced programmers could find real value in this book - particularly if the programmers are new to Drupal. This book has some of the clearest, easiest to understand explanations of Drupal. If you spent much time reading the Drupal documentation, you will really appreciate the author's writing style. I'll be teaching Drupal soon, and I'm considering using this book as part of the course.I like the structure of the book. After providing an excellent overview of Drupal, the first major exercise is modifying an existing Drupal theme. That is how most people start off learning how to theme anyway, but with this guide they should have a much better idea of what they are doing than most beginning theme designers. The second major assignment is for the programmer to design a theme from scratch. After completing both of these assignments, the reader should have tremendous confidence that they will be able to design a theme.I wish the author had written about CCK and views moduales. They are important to many sites, and his writing style would have been a welcome addition to the documentation.
Amazon Verified review Amazon
Bruce Kersten (bruce@savantcreative.com) Jun 19, 2008
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is exactly what I have been looking for. Being pretty new to Drupal I had been using the documentation at the Drupal site. It is good for starting off but my company, Savant Creative Group - [...] - needs to develop our own themes. The book is well written, well documented and not too heavy on PHP. It is great for design people who know html and css.
Amazon Verified review Amazon
R. Hill Mar 14, 2008
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
A first release candidate of Drupal 6 was made available on December 20 of 2007, that is, 2 days prior to the publication of this theming guide, which covers Drupal 5. Drupal 6.1 has since been released, and many of Drupal's most popular add-on modules are now ready for use on production web sites. The author mentioned on his blog that an updated version of his book will be published, but Packt Publishing is not yet listing 'Drupal 6 Themes' among its upcoming publications. Still, I read the book, and worked through its examples on a Drupal 6 install. As a somewhat seasoned Drupal developer, I still found the book helpful. I highly recommend it, provided that as you read along you refer yourself to the concise (and well-put-together) Drupal 6 theming guide available on Drupal.org. Theming has definitely taken a leap forward in D6. For instance, intercepting and overriding theming functions is a lot easier now.What this book covers:Chapter 1 ("The Elements of a Drupal Theme") presents the theming terminology used in Drupal, and that hasn't changed in Drupal 6.Chapter 2 explains how to set up and configure a theme in Drupal through the admin interface. By way of example, we download the theme Gagarin from Drupal.org and install it. We also configure 'Garland', which still is the default theme shipped with Drupal. Surprisingly, I learnt quite a handful of tricks in this chapter. All of it is applicable to Drupal 6; even the neat PHP snippets used for the content & visibility of custom 'blocks' work as is. For fun, I ported the Gagarin theme to Drupal 6 in less than 10 minutes, using a porting guide put together by Wesley Tanaka. Your milage may vary (you may do it faster than I).Chapter 3 explains how the PHPTemplate 'engine' works. Wordy as it is, the definition of a theming engine remains somewhat ambiguous. You may download this chapter from the publisher's web site. Take note that the default PHPTemplate 'template' files have been moved to their respective core module folder in Drupal 6. For example, you'll find the default page.tpl.php file under /modules/system, and node.tpl.php under modules/node.Chapter 4 is a reference guide to stylesheets and themable (ie:overridable) functions. Only a brief description (ie: one sentence) is provided for each function. The author gives us a snippet of PHP code that produces a list of the theming functions used on the page, but it's somewhat useless because with it we don't know which function produces what markup. In Drupal 6, a neat & "sexy" add-on module, part of the 'Devel' kit of modules, tells us which function to override (and so much more): by Firebug-style point-and-click, we select the DOM element we wish to theme, and we learn how to do so through a 'tool tip'.Chapter 5 presents different ways to intercept & override themable functions. In Drupal 6, one of these ways has been simplified, that of "placing overrides in dedicated [template] files" for which no default file exists. One no longer needs to tell the theming engine about the presence of the template file, as we used to inside template.php. In the instance where we want additional variables to become available inside the template, we use the new Drupal 6 function themeEngineName_preprocess_hook.In Drupal 6, adding stylesheets (besides the default style.css) is as easy as adding a few lines in a new 'info' file for the theme. Same with creating new regions on the page : the theme.info file takes care of that. (For these, one needs not add any PHP code to template.php.)In chapter 6, we modify a theme, 'Zen'. Be warned : even the drupal-5 version of this theme has undergone significant change since the publication of the book.In chapter 7, we learn how to create a theme from scratch -- and so much more (this chapter definitely should have been broken down). We're finally presented with a list of the variables available in each template file. In Drupal 6, many variables have been renamed (for example, $sidebar_left has become... $left), and new handy ones have been created which are available in all templates, for exampe $logged_in and $is_admin. Note that we should use the new D6 variable $body classes to apply dynamic CSS styling, instead of the ol' $layout (still available).In chapter 8, we learn how to theme forms. I had to do some research to find how to apply the author's solutions within Drupal 6. Some change is trivial, for example the handy hook_ form_alter function has different parameters passed to it in D6, and one only needs to change the function's 'prototype', ie:From that in D5 : function modName_form_alter($form_id, &$form){To this in D6 : function modName_form_alter(&$form, $form_state, $form_id){In D6, some form-theming solutions are easier to implement... or more difficult: I still haven't figured how to use images for the forms submit button. However, imo, a CSS solution is preferred in Drupal 5 _and_ 6.What this book does not cover, and I wish it did:- How to use jquery, the wondrous javascript library shipped with Drupal (there is no mention of it, really).- How to produce a theme with a configurable color scheme, using the Color Module. A simple tutorial where we create a theme for which we can change the color of the header and/or links through the 'setttings' UI would have been awesome.- Related to the last point, we're not shown how to modify the theme's settings page - to add to it.- How to theme 'Views' pages, and nodes created with the Content Construction Kit (CCK).- How to commit a theme to Drupal.org CVS (using a freeware utility like TortoiseCVS, for example).This book is particulary successful at breaking down information into bits and steps. It's extremely well-written, quite technical and in-depth, and provides a handful of screen captures in most places. We can theme it _all_ in Drupal, and the author drives that point home.Where the book somewhat falls short in its delivery:- Although the author comes from a 'design background' (so it says in the book's preface), he fails to inspire. The theme created from srcatch is particularly unappealing.- When it comes to designing Drupal themes, we're faced with basically copying and pasting CSS rules scattered throughout a set of *.txt source files to one stylesheet.To be fair, this is not a book on CSS, nor web design.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.