Change layout of a view 'page display' based on number of grouping field occurences
I think what you are trying to drupalize/ise this into is something along the lines of:

function YOURTHEME_preprocess_views_view(&amp;$vars) {

  $view=$vars['view'];

  if (empty($view)) {
    watchdog('YOURTHEME', 'Rut roh Rastro....');
    return;
  }

  switch ($view-&gt;name) {

     case 'need':

        if ($view-&gt;current_display=='page') {

          $tid_arr = $view-&gt;field['term_node_tid']-&gt;view-&gt;field['term_node_tid']-&gt;items;
          $terms = array_keys($tid_arr);
          $number_tids = count($terms);

          if ($number_tids == 1) {
            drupal_add_css(path_to_theme() . '/css/my_custom_css.css');
          }

        }

        break;

     // any other views here

  }

}


with my basic comment being that you switch on the View's name in the preprocess function and do all your work in there instead of going out into another function.