Code to drupal view count result
<?php
// Lift the globals into local scope to save typing $GLOBALS[''] every time...
global $pager_page_array, $pager_total_items, $pager_total, $current_view;
if ($pager_total[0] == 1) { // Number of pages == 1
echo "Showing <b>" . $pager_total_items[0] . "</b> results";
}else{
// Page number is zero-based (first page is 0)
// Multiply pager_limit by page number (eg 0, 15, 30) and add 1 to get first item
$start = 1 + ($pager_page_array[0] * $current_view->pager_limit);
// Multiply pager_limit by page number + 1 (eg 15, 30, 45) to get last item
$end = (1 + $pager_page_array[0]) * $current_view->pager_limit;
// Use total items count if this is less than that
if ($end > $pager_total_items[0]) $end = $pager_total_items[0];
echo "Showing $start-$end of <b>" . $pager_total_items[0] . "</b> results";
}
No comments:
Post a Comment