(Tutorial) Making Drupal Theme Building Easier on the Designer
Tips : Making Drupal Theme Building Easier on the Designer
The fundamental of any Site Design is in the div structure of the html document. Many web designers have a personal preference for how they structure and assign IDs to their layout-level div elements. This might be a simple naming convention that is semantic to the designer, or the names may correspond to a default CSS that the designer uses to streamline her styling process.
Having this habit allows the designer to focus on execution of the design, rather than constantly reading the page template to decide how to slice a photoshop comp or which selectors to use in the CSS file. Designing for Drupal can become a laborious process for any designer when they find themselves constantly needing to be reminded of exactly which element is being targeted.
Anyone with a rudimentary proficiency in HTML and PHP should be able to easily make the template edits necessary to customize a Drupal Theme’s page layout. If you are planning to make changes to an existing Theme (rather than making a new Theme from scratch), it is advisable to not edit the existing Theme, and instead create a sub-Theme. To do this, create a new folder in the same Themes directory as the Theme you are working from, with the name of your new Theme. Copy the .info file from the existing Theme into the new directory, and edit the file. Change the name to your new Theme’s name and add the following line to the file:
base Theme = baseThemeNameObviously, replace “baseThemeName” with the name of the base Theme you are using. Now you have a sub-Theme to work from. Copy from your base Theme any files you plan to make changes to, for this task we will be editing the .info file and page.tpl.php.
The first step in building a custom template layout is to edit the Regions defined in your Theme’s .info file. A Region is simply a variable to which you can assign Blocks. Region definitions look something like this:
Regions[Region_name] = Region Name
Regions[Region_name_2] = Region Name 2The text in brackets is the machine-readable (no capital letters, special characters, spaces or hyphens, must not begin with a number) name and the text following the equals sign (=) is the human-readable name of the Region.
Begin each new Region definition on a new line and use a semi-colon(;) to comment-out any unwanted Regions. Be sure that your Regions are defined in a semantic order. The header should be at the top, body content in the middle, and footer at the end of the list. The order in which you define your Regions will be the order that the Regions appear on your Blocks building page.
Now that you have defined the Regions that can output content, the next step is to edit your Theme’s page.tpl.php file to designate an area for the Regions’ content. Printing a Region’s content involves one simple line of PHP:
<?php print $Region_name; ?>Be sure to have this line of code for each Region you created in the .info file.
Courtesy : Coalmarch.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)