- Drupal 6 Theming Cookbook
- Karthik Kumar
- 658字
- 2021-04-13 16:56:47
Before we begin, we need to familiarize ourselves with a seemingly trivial yet crucial task that needs to be performed on a routine basis during theme development—clearing the theme registry. The theme registry is essentially a table that Drupal uses to list and track the files and features of a theme, as well as the theme functions which are being exposed by modules and the theme itself.
While it is recommended practice to turn on Drupal's cache feature only for production sites, the theme registry is built and cached regardless of other caching options. As a result, any changes that affect the structure of the theme will necessitate the clearing of the theme registry.
Rebuilding the registry is an intensive operation which is required only when changes have been made to the theme's files.
There are a number of ways of clearing the registry. In a stock Drupal installation, visiting admin/settings/performance
(Home | Administer | Site configuration | Performance) and clicking on the Clear cached data button will clear all cached data, including the registry, and force a rebuild.
However, during development or debugging, we will want to clear the registry with great regularity. Rather than having to do so manually, it is often handy to be able to instruct Drupal to perform this operation automatically on every page load. Some themes, including the Zen-based theme which we will be familiarizing ourselves with later in this chapter, offer an option on their configuration pages to rebuild the registry on every page load. While this is certainly convenient, the recommended method of managing this and other development-oriented operations is through the use of the Devel module.
As the name suggests, the Devel module is one which is tailor-made for use during development. It can be downloaded from http://drupal.org/project/devel. Once the module has been downloaded and installed, navigate to admin/settings/devel
(Home | Administer | Site configuration | Devel settings) where the option to Rebuild the theme registry on every page load can be enabled.
Drupal maintains a cache of all .info
files, template files, and theme functions in the theme registry. This registry is a part of the cache
table in the Drupal database. When we click on the Clear cache data button in the performance settings page, all Drupal is doing is clearing this entry in the cache table, which automatically forces a rebuild of the registry. The Devel module does the same thing when the Rebuild the theme registry on every page load setting is enabled, except that it does this automatically on every page view.
Note
It is important to keep in mind that rebuilding the registry, or for that matter, clearing any of the caches is an expensive operation which adversely affects the performance of the site. Therefore, it is recommended that this setting only be enabled during development and not in production sites.
Clearing the registry is an important factor to keep in mind during development and especially during debugging. More information on development and debugging tools including the Devel module is available in Chapter 5, Development and debugging tools.
The Devel module also provides a block with handy shortcuts to oft-used areas of the site.
The Devel module provides a Development block which can be enabled via the block management page at admin/build/blocks
(Home | Administer | Site building | Blocks). Once enabled, the block lists, as in the following screenshot, a number of links to perform operations such as emptying the Drupal cache, rebuilding the menu cache, and even reinstalling modules. Emptying the cache will also force a rebuild of the theme registry.

- InDesign平面設計案例教程:從設計到印刷
- 零基礎學數碼攝影后期
- Photoshop圖形圖像處理實用教程
- Ogre 3D 1.7 Beginner's Guide
- CMS Design Using PHP and jQuery
- 正則表達式必知必會(修訂版)
- 說服力:工作型PPT該這樣做(第2版)
- After Effects影視動畫特效及欄目包裝案例實戰
- Vue.js實戰
- Photoshop手繪從新手到高手
- 中文版3ds Max 2016/VRay效果圖制作技術大全
- Oracle E/Business Suite R12 Supply Chain Management
- 同花順軟件操作技巧與實戰指南
- Photoshop CC 從入門到精通
- Oracle Modernization Solutions