سؤال

I need to create a template for a view i've created (which I know how to do) but I don't want the page to be wrapped in the drupal html.php code. I want the resulting page to be only what is in the template file I create.

How do I do this?

I did found this which does what I need for content types lab

function yourthemename_preprocess_html(&$vars) {
  if ($node = menu_get_object()) {
    if($node->type == "lab") {
      $vars['theme_hook_suggestions'][] = 'html__lab';
    }
  }
}

Then created a file called: html--lab.tpl.php

Can this method be used for my view? does it have to be if($node->type == "lab")? can I use something like if($view == "viewname")

Thanks C

هل كانت مفيدة؟

المحلول

I think when you says "created a view" you mean a view + a page display. So, when you browse to http://mystite.com/mypage, it will show the content of view.

In this case, you can use your code with some small modifications.

function yourthemename_preprocess_html(&$vars) {
  if (arg(0) == 'mypage') {        
    $vars['theme_hook_suggestions'][] = 'html__mypage';        
  }
}

You will have to create the right .tpl.php file and clear the cache.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top