Preprocessor to use a different template for popup window I'd like to provide the ability to open some content in a new window without all of the headers and sidebars of the normal content window.  I tried to do this with a preprocessor, and got close, but still no cigar:

function THEME_preprocess_page(&amp;$vars) {  
  if (isset($_GET['popup']) &amp;&amp; $_GET['popup'] == '1') {
    //error_log( var_export( $vars['theme_hook_suggestions'], true ) );
    // returns as last array item: page__node__3
    $vars['theme_hook_suggestions'][] = 'page__node__3__popup';
  }
}


I then have a template with the file name: page--node--3--popup.tpl.php which is just a straight copy of the region--content.tpl.php file, and it actually does hit that template!  The problem is that only the title shows up - and when I clear the cache I get a warning message that content is undefined in my popup template. I've also tried naming the file and setting the theme_hook_suggestions to 'region--content--popup'/'region_content_popup' with the same results.

Here is the content of region--content--popup.tpl.php

&lt;div&lt;?php print $attributes; ?&gt;&gt;
  &lt;div&lt;?php print $content_attributes; ?&gt;&gt;
    &lt;a id="main-content"&gt;&lt;/a&gt;
    &lt;?php if ($title): ?&gt;
    &lt;?php if ($title_hidden): ?&gt;&lt;div class="element-invisible"&gt;&lt;?php endif; ?&gt;
    &lt;?php print render($title_prefix); ?&gt;
    &lt;h1 class="title" id="page-title"&gt;&lt;?php print $title; ?&gt;&lt;/h1&gt;
    &lt;?php print render($title_suffix); ?&gt;
    &lt;?php if ($title_hidden): ?&gt;&lt;/div&gt;&lt;?php endif; ?&gt;
    &lt;?php endif; ?&gt;
    &lt;?php if ($tabs): ?&gt;&lt;div class="tabs clearfix"&gt;&lt;?php print render($tabs); ?&gt;&lt;/div&gt;&lt;?php endif; ?&gt;
    &lt;?php if ($action_links): ?&gt;&lt;ul class="action-links"&gt;&lt;?php print render($action_links); ?&gt;&lt;/ul&gt;&lt;?php endif; ?&gt;
    &lt;?php print $content; ?&gt;
    &lt;?php if ($feed_icons): ?&gt;&lt;div class="feed-icon clearfix"&gt;&lt;?php print $feed_icons; ?&gt;&lt;/div&gt;&lt;?php endif; ?&gt;
  &lt;/div&gt;
&lt;/div&gt;


The H1 page title appears and nothing else.
You probably want:

print render($page['content']);

You can find the variables available to you in the template by printing get_defined_vars() using print_r(), core's debug() function, or one of the extremely handy devel module debugging functions such as kpr() or dpm().

I'd install devel and do this:

kpr(get_defined_vars());

Your modal method might not play nicely with page cache so I'd definitely test to make sure it fits your usecase.