i created a view ,checked "Provide Page View ", and set "Nodes per page" as 10.
then the page looked like this:

*****
*****
*****
.......

1 2 next › last »

how can i get the count of the page?
just like this:

*****
*****
*****
.......

1 2 next › last » total: 78 pages

Comments

mshaver’s picture

I added the total pages to the theme_pager function in my template.php file. This function has the global variable $pager_total and you can add the $pager_total_items as well. Here is the phptemplate theme I used:

function phptemplate_pager($tags = array(), $limit = 15, $element = 0, $parameters = array()) {
  global $pager_total, $pager_total_items;
  $output = '';

  if ($pager_total[$element]) {
  	if ($pager_total[$element] > 1) {
    	$output .= '<div class="pager"><strong>Pages:</strong>';
    	$output .= theme('pager_first', ($tags[0] ? $tags[0] : t('first')), $limit, $element, $parameters);
    	$output .= theme('pager_previous', ($tags[1] ? $tags[1] : t('previous')), $limit, $element, 1, $parameters);
    	$output .= theme('pager_list', $limit, $element, ($tags[2] ? $tags[2] : 9 ), '', $parameters);
    	$output .= theme('pager_next', ($tags[3] ? $tags[3] : t('next')), $limit, $element, 1, $parameters);
    	$output .= theme('pager_last', ($tags[4] ? $tags[4] : t('last')), $limit, $element, $parameters);
		$output .= '</div>';
	}
    $output .= '<div class="pager_totals description"><strong>Total Pages:</strong> '.$pager_total[$element].' | <strong>Total Items:</strong> '.$pager_total_items[0].'</div>';

    return $output;
  }
}
breaddawson’s picture

thank u very much!!
it works!!!

runacid’s picture

if you set $view = views_build_view('type', $myview, array(), NULL, NULL) in your template you can access the total number of items using $view->num_rows.

moshe weitzman’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.