1

I created a page using a custom module, it has a template file too and it works well. But when i visit my page it shows wrapped by my default theme, it's obvious. The thing is that i would like to show that content in a clean page.

Is there a function or something that lets me do it? without modules like ThemeKey

4

If you want to show content in clean page you can use theme_hook_suggestions in THEME_preprocess_html and THEME_preprocess_page with passing some GET variable. For example for clean pages you can add $_GET['embed'] = 1 and in preprocess functions write the following code:

function THEME_preprocess_html(&$vars) {
  if (isset($_GET['embed'])) {
    $vars['theme_hook_suggestions'][] = 'html__embed';
  }
}

function THEME_preprocess_page(&$vars) {
  if (isset($_GET['embed'])) {
    $vars['theme_hook_suggestions'][] = 'page__embed';
  }
}

Then copy paste html.tpl.php and page.tpl.php and rename to html--embed.tpl.php and page--embed.tpl.php. Ultimately remove unnecessary code from template files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.