0

I have a hook_boot() module that detects certain circumstances and changes the theme using $custom_theme to a specific theme. All works good, however if Drupal has a cache of the page that page will be served regardless of the fact it is not the correct theme.

Is there anyway to force drupal not to use and caches for that specific theme? Or is there a way to force drupal to keep two caches? One for each theme?

I am using Drupal 6 btw.

0

From my point of view, the better way is to use your own cache system, but don't worry is nothing very complicate.

Copy the includes/cache.inc and put it somewhere in sites/all/libraries or whatever you want. After in your settings.php you've to add $config['cache_inc'] = 'sites/all/...'; and Drupal will replace is own cache system by yours. This file contains three functions, clear_cache_all, cache_set and cache_get. Here the idea is to add the name of your theme before all $cid.

I never tried it, so I'm not sure if you can have access to this informations, but you can try .

  • The problem I can see with this solution is that the cache contains also data that are not output, or that don't change basing on the theme being used. Unconditionally adding the theme name to the cache ID is not something I would suggest. – kiamlaluno Aug 24 '11 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.