Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Drupal 6 Theming Cookbook

You're reading from   Drupal 6 Theming Cookbook Over 100 clear step-by-step recipes to create powerful, great-looking Drupal themes

Arrow left icon
Product type Paperback
Published in Nov 2010
Publisher Packt
ISBN-13 9781847198686
Length 384 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Toc

Table of Contents (18) Chapters Close

Drupal 6 Theming Cookbook
Credits
About the Author
About the Reviewers
1. Preface
1. Drupal Theme Basics 2. Beyond the Basics FREE CHAPTER 3. Custom Themes and Zen 4. Templating Basics 5. Development and Debugging Tools 6. Advanced Templating 7. JavaScript in Themes 8. Navigation 9. Form Design 10. Customizing CCK 11. Views Theming 12. Rapid Layouts with Panels Index

Allowing users to choose from multiple themes


This recipe details the steps involved in enabling users to choose which theme they wish to use when they are viewing the site. For example, users with accessibility issues might prefer to view the site using a high-contrast theme, or those viewing the site via monitors with low resolutions might prefer a theme which uses a fluid layout.

Drupal's flexible approach to themes includes the ability to allow theme-specific block arrangements. As a result, this allows us to, for example, have a separate theme for site contributors with, perhaps, an extra sidebar equipped with a contributor-specific block arrangement.

Getting ready

Since we are going to be working with multiple themes in this recipe, we will need at least two themes to have been enabled on the site. This can be done via the theme administration page at admin/build/themes (Home | Administer | Site building | Themes) as seen earlier in this chapter.

How to do it...

We can enable users to choose between the different themes which are available through the following steps:

  1. Navigate to admin/user/permissions (Home | Administer | Users | Permissions).

  2. Scroll down to the section titled system module dealing with system-level permissions.

  3. Check the box labeled Select different theme for the authenticated user role.

  4. Click on the Save permissions button to save our changes.

  5. Now, visit the My account page at the path user and click on the Edit tab at the top.

  6. Locate the newly available section titled Theme configuration.

  7. Choose the preferred theme by selecting the associated radio button as in the following screenshot:

  8. Click on the Save button at the bottom of the page to register our changes.

How it works...

Drupal saves the users' choice as a configuration setting in the database. When a page is to be displayed, Drupal notices this setting and themes the page using the specified theme instead of the site's default theme.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image