Hi!

I have a file "node-news.tpl.php" inside my theme catalog and inside this file I have:

  $images_per_page = 12;
  print theme('pager', array(), $images_per_page, 0);

This code works great, but it generates FULL pager and I need MINI pager. I tried to change 'pager' into 'mini' but it isn't work.

Does anyone know how to use mini pager?

Comments

egomac’s picture

I believe mini_pager is a views function and not part of core.

Taken from views module, you can override this on your template.php replacing 'theme_' with 'yourtemplate_'

function theme_views_mini_pager($tags = array(), $limit = 10, $element = 0, $parameters = array(), $quantity = 9) {
  global $pager_page_array, $pager_total;

  // Calculate various markers within this pager piece:
  // Middle is used to "center" pages around the current page.
  $pager_middle = ceil($quantity / 2);
  // current is the page we are currently paged to
  $pager_current = $pager_page_array[$element] + 1;
  // max is the maximum page number
  $pager_max = $pager_total[$element];
  // End of marker calculations.


  $li_previous = theme('pager_previous', (isset($tags[1]) ? $tags[1] : t('‹‹')), $limit, $element, 1, $parameters);
  if (empty($li_previous)) {
    $li_previous = " ";
  }

  $li_next = theme('pager_next', (isset($tags[3]) ? $tags[3] : t('››')), $limit, $element, 1, $parameters);
  if (empty($li_next)) {
    $li_next = " ";
  }

  if ($pager_total[$element] > 1) {
    $items[] = array(
      'class' => 'pager-previous',
      'data' => $li_previous,
    );

    $items[] = array(
      'class' => 'pager-current',
      'data' => t('@current of @max', array('@current' => $pager_current, '@max' => $pager_max)),
    );

    $items[] = array(
      'class' => 'pager-next',
      'data' => $li_next,
    );
    return theme('item_list', $items, NULL, 'ul', array('class' => 'pager'));
  }
}
dagomar’s picture

Got views installed? Just use

print theme('views_mini_pager', array(), $images_per_page, 0);

Dagomar Paulides
B.A. Digital Media Design
Partner @ Online Agency