Difference between hook_page_alter and preprocess_page? I don't completely understand when I should use hook_page_alter(&amp;$page) or template_preprocess_page(&amp;$vars, $hook) in Drupal 7.

What is the best practices about that to use in template.php?

Thanks
The difference is their purpose.

hook_page_build() and hook_page_alter() are used to remove, alter, or add elements at the page level.
The $page array passed to hook_page_alter() contains the top level elements for each block region. By default they are the following ones:


page_top
header
sidebar_first
content
sidebar_second
page_bottom


An example of implementation could be the following one:

function mymodule_page_alter(&amp;$page) {
  // Add help text to the user login block.
  $page['sidebar_first']['user_login']['help'] = array(
    '#weight' =&gt; -10, 
    '#markup' =&gt; t('To post comments or add new content, you first have to log in.'),
  );
}


The preprocess functions are called to alter the variables that are passed to the template file. They cannot change the structure of the page, but they can alter the content of some elements of the page changing the content of those variables.
For example, the Overlay module removes the primary tabs when the page being visualized is the overlay.

function overlay_preprocess_page(&amp;$variables) {
  if (overlay_get_mode() == 'child') {
    unset($variables['tabs']['#primary']);
  }
}