About the Reviewer

Dave Myburgh started out in computers when entire operating systems ran on a single floppy disk and 640kb of RAM was a lot He studied to become a molecular biologist, but never lost his passion for computers. Later, he ran a successful computer company for a couple of years in South Africa, before moving to Canada with his wife. He went back to science on his arrival in Canada, and since discovering Drupal almost two years ago, he has once again started his own company, MybesInformatik. He...

How to Name Your Overrides

Phptemplate System Override

At run time, Drupal is designed to seek out overrides to themeable functions before applying the default functions. The system does this by looking for files in the following order (assuming your site employs the PHPTemplate engine) 1. themename_functionname (e.g., garland_breadcrumb) 2. themeengine_functionname (e.g., phptemplate_breadcrumb) 3. theme_functionname (e.g., theme_breadcrumb) The naming convention is the key and must be followed scrupulously, because the name establishes the order...

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

CSS in Zen Tao

The creation of a sub-theme a theme within a theme, if you will is made possible by the way Drupal works with themes. The system allows you to create multiple themes based on the same set of underlying files through the use of an additional CSS file placed within a subdirectory. The same approach used here in Zen and Tao , is employed in the default Garland theme, which includes the sub-theme Minelli, and in the default theme Chameleon, which includes the sub-theme Marvin. The CSS files of our...

Set User Access

We now need to set the user permissions so that our site visitors can see and use the various functionalities we've set up. Go to the User management section and open the Access control manager. Select the following for anonymous user access Access site-wide contact form Save your new permissions and let's move on to the next step in our preliminary preparations.

Sidebar Right

This snippet places the blocks designated for the right Region into a table cell. Note the conditional statement this allows the output to be hidden in the event that no blocks are assigned to the Region. For styling, the table cell td is given an id named to reflect the placement sidebar-right . if show_blocks amp amp empty blocks_right output . lt td Note that the official Drupal site provides an alternative syntax Q for inserting Regions into your pure PHP theme. See http www.drupal.org node...

The Poll Module Forms

Poll Drupal

The Poll module involves several forms. The two we will deal with here are the Poll Block Form and the Poll Page Form. How the functional units will be grouped within the structure of the page . tpl. php file. How the functional units will be grouped within the structure of the page . tpl. php file. Drupal provides several themeable functions that affect the Poll module. Unlike the bare-bones themeable functions provided for the Search Forms, the functions for the Poll module give you a great...

Cloning a Theme

Let's get started by making a copy of the Zen theme. We'll keep the original and work on the copy. I recommend you always employ this approach to cloning themes by preserving the integrity of the original, you have a reference and you maintain the ability to roll back your changes in the event a serious problem arises. Cloning a theme is a simple matter. First, make a copy of the original theme and place the copied directories in the sites all themes directory. Next, rename the directory with...

Intercepting Template Files

Up to this point, we have limited the discussion to how to handle overriding primary template files and individual functions however, in Drupal, you can extend the intercept and override concept further to achieve highly granular control of the page templates that are called in various situations. You can, in other words, intercept and override entire page files on a conditional basis. For example, if you wish to have different templates used for different types of content, you can create...

Adding HTML via Function Attributes

The Drupal form API makes provisions for you to be able to add basic HTML to a form via a limited set of attributes named prefix, suffix, and markup. These attributes are invoked from inside the function accordingly, this approach to modifying forms is used most frequently by developers when they create the form. prefix is used to add HTML before a form element. suffix is used to add HTML after an element. markup allows you to declare HTML as type markup in the form. This approach is generally...

Set Block Visibility

The only thing left at this stage is to configure the Block visibility in a common sense 1. Display the User login Block on the home page only 2. Hide the Button ad Block on the administrator pages 3. Display the Recent blog posts Block throughout the Forum posts First the User login Block. Go to the Blocks Manager and click the Configure link on the User Login block. Change the Page specific visibility settings to the second option, Show on only the listed pages. In the Pages text box enter lt...

PHP XTemplate

PHP XTemplate was once the default templating engine in Drupal but has fallen by the wayside as development of the application slowed. For many users, XTemplate was a popular system. It separates the HTML from the PHP and makes it easy for designers to work with themes. Also, as it is written in PHP and can handle either PHP4 or PHP5, it tends to perform well with Drupal. Unfortunately, at this stage, it seems unlikely to be making a comeback in the near future, and those of you who previously...

Setting Up the Workspace

There are several software tools that can make your work of modifying themes more efficient. Though no specific tools are required to work with Drupal themes, there are a couple of applications that you might want to consider adding to your tool kit. I work with Firefox as my primary browser, principally due to the fact that I can add into Firefox various extensions that make my life easier. As mentioned in the previous chapter, installing the Web Developer extension is hugely helpful when...