/ Published in: PHP
Expand |
Embed | Plain Text
function module_view_totals($viewName, $display_id = 'default', $argument) { // load viewobject $view = views_get_view($viewName); // ensure view exists if (!$view) return; // set object property to return total rows $view->get_total_rows = true; // set display_id $view->set_display($display_id); //set argument // execute view $view->execute(); // acquire data from views object and $_REQUEST $itemsPerPage = $view->pager['items_per_page']; $currentPage = $_REQUEST['page']+1; $total = $view->total_rows; // start calculation $start = 10*$currentPage-9; $end = $itemsPerPage * $currentPage; if ($end>$total) $end = $total; // return html //return "Displaying $start - $end of $total"; return $total; }
You need to login to post a comment.
