Reply to comment

This article explains how to switch your theme. In our example we will switch the theme if one of the fields of our node has a certain value.
Use hook_init() to accomplish this.

<?php
function thuis_sanitech_extra_init() {
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    global $user;
 
    if ($node->field_theme_keuze[0]['value'] == 1) {
      //load appropriate theme
      $user->theme = 'affaires';
      init_theme();
    }
    if ($node->field_theme_keuze[0]['value'] == 0) {
      //load appropriate theme
      $user->theme = 'sanitechniek';
      init_theme();
    }
  }
}
?>

What you need to do is set the global user->theme to the right theme and run init_theme(). That's it.

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><p><b><i><table><th><tr><td><blockquote><br /><img /><tbody><span><strike>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <codes>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.