Undefined variable error in node.tpl.php I'm using the Basic theme, and I get the following error when I refresh my site.


  Notice: Undefined variable: unpublished in include() (line 18 of /Users/me/Projects/mysite/httdocs/sites/all/themes/mytheme/templates/node.tpl.php).


The line that is caused the notice is the following one.

    &lt;?php if ($unpublished): ?&gt;
      &lt;p class="unpublished"&gt;&lt;?php print t('Unpublished'); ?&gt;&lt;/p&gt;
    &lt;?php endif; ?&gt;
  &lt;/header&gt;
&lt;?php endif; ?&gt;


I don't understand this error. How can I fix it?
Try if ($node-&gt;status == 0) instead of if ($unpublished).

This may be happening because the variable is not set correctly in a hook_preprocess_node() implementation of the theme; you may also want to check the template.php file in your theme for these hooks.