How to pass variables between preprocess functions I've some problem with themes and preprocess functions.

I see that, if I declare a variable in, for example, MYTHEME_preprocess_region(&amp;$vars), this variable is available ONLY in region.tpl.php (I'm using Omega).
But in preprocess_region and region.tpl there is the $vars['node'] variable (if I'm displaying a node), so in these functions I can't create variable based on $node.

In my example, the $vars['node'] variable is available in preprocess_page and preprocess_node.

The question is: if I want to add on region.tpl.php (or preprocess_region) a variable based on $node how should I do?

The "general" question is: how can I declare a variable in a theme function, in template.php, and let this function available in other functions?
Hm...

First of all you should control order of preprocess functions execution.

preprocess_block executes earlier than preprocess_region, preprocess_region earlier than preprocess_node, and so on...

In first preprocess, you should declare static variable, like here.

$var = &amp;drupal_static('variable_name_that_will_be_placed_in_static_stack');
if (!isset($var)) {
  $var = $value_to_store;
}


So, you can access this var from later executed functions.

$var = &amp;drupal_static('variable_name_that_will_be_placed_in_static_stack');


As for your problem, it's more easy to get node from menu_router:

theme_preprocess_region(&amp;$vars)
  $node = menu_get_object();
  if ($node) {
    // get required value
  }
}