Using Theme Related Modules

Having ultimate control over the theming of your web site is important, but many times, it would be nice if you could use prebuilt tools to handle some common tasks. Fortunately, several contributed modules are aimed at giving you more power and flexibility over the looks of your site. Here are five such modules that can be downloaded from the contributed repository on Drupal.org:

Blog Theme: If you have multiple themes activated for your site, registered users will be able to choose which theme they wish to use. The Blog Theme module (http://drupal.org/ node/19248) capitalizes on this to make blog postings on the site more personalized. When this module is installed and activated, blog postings will be displayed in the author's chosen theme.

Themedev The Themedev module (http://drupal.org/project/themedev) comes packaged with a number of diagnostic style sheets that, when loaded, augment a page by highlighting various elements. The administrator can turn the style sheets on or off in a role-based fashion, so that you can create a special user role for the theme designer. The style sheets include tools to highlight page structure, list structure, and table structure. They can also highlight tags that are deprecated in XHTML 1.0 Strict, tags that are commonly misused, and constructions that could hinder usability. Figure 5-9 shows an example of using the Themedev module.

Figure 5-9. The Themedev module in action

Theme Editor: With the Theme Editor module (http://drupal.org/project/ theme_editor), the themes that are found in the themes directory serve as a sort of template repository on which an arbitrary number of new themes can be created and developed, all from the web interface. When a new theme is created, the user is asked to choose an existing theme, which will then be copied into a working directory and renamed. All of the text files can be edited directly in the browser, and new files can be added to the directory via HTTP upload. This is a useful module in several circumstances. Perhaps you would like to allow users on your site to have control over their own theme without granting them FTP or shell access to the server. Or perhaps you've hired a developer to edit your theme and want to allow him to work on the theme directly with the browser.

Caution Don't forget that anyone who can edit theme files can run PHP code on your server. Letting the general public use the Theme Editor module is a severe security risk.

Sections: A common request seen on Drupal.org is to add a mechanism that allows for different themes in different sections or areas of a site. Perhaps the forums should look different from the book pages. Maybe the front page should have its own theme distinct from the rest of the site. Or perhaps the tables and controls in the administrative sections of the site don't work well in the theme that looks good for the content areas of the site. The Sections module (http://drupal.org/project/sections) allows you to define sections of your site that have distinct themes. The pages that are included in these sections are defined by using paths, just as block administration is done. Using a path of admin*, for example, will define a section that includes all of the administrative pages, allowing you to pick a theme that works well for the wide tables, while leaving untouched the main theme that makes your blog sparkle and shine.

Taxonomy_theme: Another strategy for assigning a theme other than the main theme to a page is through the taxonomy system. Using the Taxonomy_theme module (http:// drupal.org/project/taxonomy_theme), the administrator has the chance to associate themes with taxonomy terms. When a node is viewed and has been categorized with one of these terms, the theme of the page is taken from the term. This system would be useful on a site where the design and presentation need to change depending on the content of the posts.

0 0

Post a comment