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

The Advanced Search Form

Clicking on the advanced search link on the Page Search Form brings the user to the Advanced Search Form, which includes a number of new options for searching the site. More options appear here and more formatting issues. The Advanced Search orm appears in the content region. More options appear here and more formatting issues. The Advanced Search orm appears in the content region. The Advanced Search Form is produced by the function search_form, working in conjunction with the code in the node...

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

What is PHPTemplate

PHPTemplate is one of a family of applications known as templating engines referred to frequently in Drupal and in this text as theme engines . These applications serve a middleware function and determine the coding syntax, which will be used to create the theme. As the name implies, PHPTemplate supports the popular PHP programming language for theme creation. PHPTemplate was built by developer Adrian Rossouw, and was created specifically for use with Drupal. PHPTemplate is the most widely...

Formatting the Sidebars and Footer

The Left Sidebar is unused in this theme, but the Right Sidebar Region is essential, as it contains the main navigation and several Blocks. The way the CSS is written, the style definitions for Left and Right Sidebar are combined we'll maintain that sidebar-ieft .biock, sidebar-right .biock padding-bottom 15px margin-bottom 20px I want to control the styling of the menu in the Right Sidebar our Navigation menu , so I will add the following border-top 1px soiid 676734 padding-top 10px...

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

Set Up Menus

For this theme, we're going to run the Primary Links at the top of the page. We'll set the menu named Navigation as our Main Nav on the right-hand side of the page. We'll also create a Footer Nav and place that at the bottom of the page. Access the Menu manager, under Site building, and make the changes outlined below. For the Primary Links, we will need to set up the following note that the Weight settings, which affect the ordering, are completely up to you these are simply suggestions the...

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

Where to Place Overrides

The best practice is to place your overrides inside the individual theme directory. The choice of where you place your overrides is dictated by whether your site employs a theme engine and if so, which one. PHPTal Overrides are to be placed in tempiate. php. PHPTemplate Overrides are to be placed in tempiate . php. Smarty Overrides are to be placed in smartytempiate. php. rltX Note that the Xtal templating engine does not permit you to I At run time, Drupal searches out themeable functions in a...

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

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