Template Suggestions Causing Undefined Variable I am developing a Drupal theme from scratch, and I have run into some trouble with template suggestions. Using the solutions discussed on Drupal support, I created a template.php file and included this code: 

function stronger_preprocess_page(&amp;$vars) {

  if (isset($vars['node'])) {

    $vars['theme_hook_suggestion'] = 'page__'.$vars['node']-&gt;type; //
  }
}


This has allowed me to successfully use page--nodetype.tpl.php template files, but I am also randomly seeing errors such as:


  Notice: Undefined variable: node in include() (line 24 of /Applications/MAMP/htdocs/strong-local-final/sites/all/themes/stronger/page.tpl.php).


I have read elsewhere that the node variable needs to be re-declared, but I am unsure of how or where to do this. Any help or references would be greatly appreciated!
hook_preprocess_page() is run for any page, even non-node pages. If you're getting that error it means your trying to access $node in the page.tpl.php file when you're on a non-node page. As no node is available on such a page, the variable won't have been set.

Because of the delay that can happen when messages are set in template files, you might only see this message when you've left a non-node page, and navigated to a node page. So it will look like it's that particular page complaining, when in fact it was the previous one.

You should be able to fix the problem by checking the $node variable is available in your template file as well as in the preprocess function. e.g.

&lt;?php if (isset($node)) : print $node-&gt;something; &lt;?php endif; ?&gt;