notice after entering a function in template.php I get the following notices on every page:

Notice: Undefined index: node in myZen_preprocess_page() (line 242 of /Applications/XAMPP/xamppfiles/htdocs/drupalH1/sites/all/themes/myZen/template.php).
Notice: Trying to get property of non-object in myZen_preprocess_page() (line 242 of /Applications/XAMPP/xamppfiles/htdocs/drupalH1/sites/all/themes/myZen/template.php).
Notice: Undefined index: node in myZen_preprocess_page() (line 246 of /Applications/XAMPP/xamppfiles/htdocs/drupalH1/sites/all/themes/myZen/template.php).
Notice: Trying to get property of non-object in myZen_preprocess_page() (line 246 of /Applications/XAMPP/xamppfiles/htdocs/drupalH1/sites/all/themes/myZen/template.php).


I put the function I need to use the files page--content-type, and is as follows:

function myZen_preprocess_page(&amp;$vars) {
   if ($vars['node']-&gt;type == 'mappe'){
     $vars['theme_hook_suggestions'][] = 'page__mappe';

    }
  else if ($vars['node']-&gt;type == 'fatti_e_risorse'){
    $vars['theme_hook_suggestions'][] = 'page__fatti_e_risorse';

  }

  }


Can I disable notices or fix this? thank you!
That notification is displayed because the node key of the $vars array is not always defined in hook_preprocess_page() function.

Use the following code, which first checks if the node key exists and then continues. It also uses the switch statement, which is easier to read if you only need to check the node type and use one condition:

function myZen_preprocess_page(&amp;$vars) {
  if (isset($vars['node'])) {
    switch ($vars['node']-&gt;type) {
      case 'mappe':
        $vars['theme_hook_suggestions'][] = 'page__mappe';
        break;

      case 'fatti_e_risorse':
        $vars['theme_hook_suggestions'][] = 'page__fatti_e_risorse';
        break;
    }
  }
}