I'm trying to build a new template for PPC landing pages. The template design is very different than the main template, therefore I'm trying to override html.tlp.php for a specific content type.

The content type machine name is "landing_page".

I've created the following:

html--landing_page.tpl.php (everything in the header and footer)
page--landing_page.tpl.php (everything in the content area)

I got Drupal to read page--landing_page.tpl.php, but can't get it to read html--landing_page.tpl.php instead of the default html.tpl.php.

I've already tried the code at http://drupal.stackexchange.com/questions/21751/override-html-tpl-php-pe..., but it doesn't work even after clearing the cache multiple times.

Here's what my preprocess_html function in template.php looks like:

      function bartik_preprocess_html(&$variables) {

      $node = menu_get_object();

      if ($node && $node->nid) {
        $vars['theme_hook_suggestions'][] = 'html__' . $node->type;
      }

     /* if ($vars['node']->type == 'landing_page'){
      	 $vars['theme_hook_suggestions'][] = 'html__landing_page';
      }
    */
      
      if (!empty($variables['page']['promo'])) {
        $variables['classes_array'][] = 'promo';
      }

      if (!empty($variables['page']['triptych_first'])
        || !empty($variables['page']['triptych_middle'])
        || !empty($variables['page']['triptych_last'])) {
        $variables['classes_array'][] = 'triptych';
      }

      if (!empty($variables['page']['footer_firstcolumn'])
        || !empty($variables['page']['footer_secondcolumn'])
        || !empty($variables['page']['footer_thirdcolumn'])
        || !empty($variables['page']['footer_fourthcolumn'])
        || !empty($variables['page']['footer_fivecolumn'])
        ) {
        $variables['classes_array'][] = 'footer-columns';
      }

      drupal_add_js(path_to_theme().'/js/jquery.actual.js');
      drupal_add_js(path_to_theme().'/js/custom.js');

      // Add conditional stylesheets for IE
      drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
      drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 6', '!IE' => FALSE), 'preprocess' => FALSE));
    }

Comments

Jaypan’s picture

If the design is drastically different, it may be worth creating a new theme altogether, and using hook_custom_theme() to switch the theme for the pages where it's relevant.

...at least that's how I do it.

duckzland’s picture

notice that &$variables != $vars

if you use &$variables in the function argument, you must use $variables for the variables override (and passed by reference) and vice versa.

--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com

Jaypan’s picture

Nice catch!