O'Reilly logo

Drupal 6 Theming Cookbook by Karthik Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Displaying a different theme for each day of the week

This recipe provides the PHP code that allows the rotation of themes based on the day of the week.

Getting ready

As we have seen in other recipes in this chapter, a number of sites use an "odds and ends" module to handle tweaks and customizations particular to the site. We will be using the mysite.module created earlier in this chapter to hold our customizations. It is assumed that the module is available and already enabled.

How to do it...

Open the mysite module file and paste the following code into it:

/** * Implementation of hook_init(). */ function mysite_init() { global $custom_theme; // An array of themes for each day of the week. // These themes do not have to be enabled. $themes = array(); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required