Clearing your theme registry

Another component of Drupal caching is the theme registry. Your theme and its associated functions and CSS elements can be cached by Drupal as it loads. Drupal stores this information as cached data. You may only need to worry about the theme registry if you are developing your theme and adding theme override functions to your template.php files and other Drupal theme template files.

Drupal template files control all of the PHP and HTML output of your Drupal theme. These template files are stored in the root folder of the theme you are using. You will see the following template files (and you may see more depending on how complex the theme is) when you look in a theme folder: template.php, page.tpl.php, node.tpl.php.

After adding a function to your template files, you may notice that your changes do not take effect immediately when you refresh your page. You can do the following to ensure that your function overrides show up immediately.

Clear your main Drupal cache using the method discussed earlier. Clear your cache at Administer | Site configuration | Performance. This will rebuild the theme registry on your site. Then reload the page in question and you should see your TPL changes. Another method of clearing the theme registry is to visit your Site building | Themes configuration page and click on the Save configuration button to re-save your theme's configuration. By doing this you will clear the theme registry and your latest theme changes and tweaks at the template level will be visible.

Enable your theme registry through your theme admin, if the theme developer provides an admin checkbox for this API function. For example, we're using a sub-theme of the Zen theme. As we're using the Zen theme, we have this additional Theme registry checkbox available to us. This is not included in all contributed themes.

If you go to your theme configuration page at Administer | Site building | Themes and then click on Configure, and select your specific sub-theme, you'll see a Theme Registry section. In this case with Zen, it's in a pane of the sub-theme configuration page, titled Theme development settings.

Check the box to enable the rebuilding of the theme registry on every page during development.

Drupal warns you not to enable the theme registry on a production website, as it can cause performance issues if you have it enabled and are rebuilding the theme registry on every page load. So, for now we're going to leave it disabled by unchecking the box. You can then select the box again later if you start doing theme development.

Theme development settings

Theme registry: 0 Rebuild theme registry on every page,

During theme development, it can be very useful to continuously rebuild the theme registry. WARNING: this is a huge performance penalty and must be turned off on production websites.

Wireframes: □ Display borders around main layout elements

Wireframes are useful when prototyping a website.

For more on the Drupal theme registry click on the link in the text next to the theme registry checkbox that is hyperlinked to Rebuild the theme registry on every page. This will launch a help page on drupal.org with more information about theme registry functionality: http://drupal.org/node/173 88 0#theme-registry.

Was this article helpful?

0 0

Responses

  • Dionisia
    WHERE DOES DRUPAL STORE THEME SETTINGS?
    9 years ago
  • will gammidge
    How to rebuild theme registry drupal?
    9 years ago
  • severi
    How to enable Rebuild theme registry on every page?
    9 years ago

Post a comment