How to get the views datas inside coding in drupal
To get the view datas inside coding , Use the below coding
$display = 'page_1'; // 'page_2' or 'block_1' etc
$view = views_get_view('view_name');
$vars['photos'] = $view->preview($display, arg );
$vars['photo_count'] = $view->total_rows;
Note:
arg should be array
arg should he replaced by array($vars['row']->nid) if used template.php file templatename_preprocess_views_view_fields(&$vars) { }
$display = 'page_1'; // 'page_2' or 'block_1' etc
$view = views_get_view('view_name');
$vars['photos'] = $view->preview($display, arg );
$vars['photo_count'] = $view->total_rows;
Note:
arg should be array
arg should he replaced by array($vars['row']->nid) if used template.php file templatename_preprocess_views_view_fields(&$vars) { }
Comments