hook_preprocess_views_view not loading view when records are empty I am trying to add some css and js files using the hook_preprocess_views_view_unformatted Hook in template.php

Here is my code :

function mytheme_preprocess_views_view_unformatted(&amp;$vars) {
$view = $vars['view'];
if ($view-&gt;name == "my_view_name"){

        drupal_add_css(drupal_get_path('theme', 'mytheme') .'/css/sample.css', array());
        drupal_add_js(drupal_get_path('theme', 'mytheme') .'/js/sample.js');

}}


My problem is that when the view is empty or when does not have any records the view is not loaded and thus I am unable to get the $view->name and neither are the css,js files being applied for the page.

It is working fine when the view displays a few records. So is there any other hook or method to fetch the view name or get it loaded when the records are empty ?
I found out the solution to add files to specific 'View Pages'. Need to use hook_preprocess_page in template.php and check the view_name. Here is the code that worked for me.

function mytheme_preprocess_page(&amp;$variables){
if($variables['page']['#views_contextual_links_info']['views_ui']['view_name'] == 'my_view_name'){
    drupal_add_css(drupal_get_path('theme', 'mytheme') .'/css/sample.css', array());
    drupal_add_js(drupal_get_path('theme', 'mytheme') .'/js/sample.js');}