Replacing display page with views in template.php since yesterday I can not solve the problem with function preprocess_views_view:
In the views named 'Calendar' I have a few display page(page_classic, page_mobile) and I would like to change preprocess_views_view function in mobile version of the site, which replace default display page(page_classic) with page_mobile. Below function, does not work:(

function mobiletheme_preprocess_views_view(&amp;$vars){
    dpm($vars);
    $view = views_get_view('calendar');
    if($view-&gt;name=='calendar'){
        $display_id = 'page_mobile';
        $view-&gt;current_display = $display_id;
    }
}


Any ideas?
Views' hooks are called whenever a View is called, yet you are calling the creation of the View once again inside of it, and then trying to change that View, not the original one.

Instead, you should be doing something along the lines of...

function mobiletheme_preprocess_views_view(&amp;$vars) {

  $name=$vars['name'];
  $display_id=$vars['display_id'];

  switch ($name) {

     case 'calendar':

       // process it here, eg change/add $vars['foo']
       break;

     // other Views here

  }

}


Now, that, changing template variables, doesn't appear to be what you want to be doing, so you will have to look into some of the other Views hooks, most probably views_pre_view to change the display, eg, something like...

function mobiletheme_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {

  if ($view-&gt;name=='calendar' &amp;&amp; display_id=='page_classic') {
    $view-&gt;set_display('page_mobile');
  }

}   


Addition/Caveat:  This appears to have to be called from a module, not a theme (at least in D6), so you may need something like this...

function mobilemodule_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  global $theme;

  if ($theme=='mobiletheme' &amp;&amp; $view-&gt;name=='calendar' &amp;&amp; display_id=='page_classic') {
    $view-&gt;set_display('page_mobile');
  }

}   


...inside a small module.