0
votes

Suppose I have www.mycoolsite.com, and want to have a sub-section like www.mycoolsite.com/hino (yes, a car-sale with a subsection holding trucks).
The ugly fact here is, actually, divided into 2:

  1. I'm an almost total n00b Drupal developer.
  2. The /hino subsection must have a different layout (a different theme).

Now I created (i.e. copy-pasted, renamed, and successfully activated) another theme I already had. Both themes are active right now.

Actually, 3 themes are active right now, counting the latter: Normal theme for Desktop devices, Normal theme for Mobile devices, and Hino theme (for Desktop devices yet; the requirement for Hino/Mobile will come later).

Currently, the selected theme is Normal/Desktop unless a mobile device connects, in which case the theme is automatically switched to Normal/Mobile. BUT that's thanks to the device detector.

What I need is to render a completely different theme (i.e. the new Hino/Desktop theme) when a request is done to a node which I think it has to belong to a new content type I must create.

So, my qestion here: How do I create a new content-type and specify another theme for it? e.g. "modelos" content-type should render the Normal theme, but "modelos-hino" (a new content-type with different fields) should render the Hino theme.

Notes:

  1. Even the page.tpl wrapper (and the menus and menu elements inside) must be different. That's why I need this instead of just creating node--modelos-hino.tpl file.
  2. Having a separate Drupal install for /hino is NOT an option.
1

1 Answers

1
votes

Based on http://drupal.org/node/224333#custom_theme You could create a custom module and use the hook_custom_theme to load the node, check its type and trigger your new theme from there. Something like:

<?php 
/**
* Implements hook_custom_theme().
*/
  function mymodule_custom_theme() {
    if (arg(0)=='node' && is_int(arg(1))) {
      $node = node_load(arg(1));
      if ($node->type == 'modelos-hino') {
        return 'Hino';
      }
    }
  }
?>