Posted By

jonathanpglick on 07/14/10


Tagged

drupal


Versions (?)

Drupal - Programatically trigger another theme


 / Published in: PHP
 

This example triggers the admin theme when on any of the user/* pages (login, edit, etc.). Put the name of your admin theme in {admin-theme-name} so there's a safe fallback in case variableget doesn't find the admintheme.

  1. $match = preg_match('/(user$)|(user\/)/', $_SERVER['REQUEST_URI']);
  2. if ($match) {
  3. global $conf;
  4. $conf['theme_default'] = variable_get('admin_theme', '{admin-theme-name}');
  5. }

Report this snippet  

You need to login to post a comment.