function theme_pager_link in Drupal 5
Same name and namespace in other branches
- 4 includes/pager.inc \theme_pager_link()
- 6 includes/pager.inc \theme_pager_link()
- 7 includes/pager.inc \theme_pager_link()
Format a link to a specific query result page.
Parameters
$page_new: The first result to display on the linked page.
$element: An optional integer to distinguish between multiple pagers on one page.
$parameters: An associative array of query string parameters to append to the pager link.
$attributes: An associative array of HTML attributes to apply to a pager anchor tag.
Return value
An HTML string that generates the link.
4 theme calls to theme_pager_link()
- theme_pager_first in includes/pager.inc 
- Format a "first page" link.
- theme_pager_last in includes/pager.inc 
- Format a "last page" link.
- theme_pager_next in includes/pager.inc 
- Format a "next page" link.
- theme_pager_previous in includes/pager.inc 
- Format a "previous page" link.
File
- includes/pager.inc, line 360 
- Functions to aid in presenting database results as a set of pages.
Code
function theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) {
  $page = isset($_GET['page']) ? $_GET['page'] : '';
  if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
    $parameters['page'] = $new_page;
  }
  $query = array();
  if (count($parameters)) {
    $query[] = drupal_query_string_encode($parameters, array());
  }
  $querystring = pager_get_querystring();
  if ($querystring != '') {
    $query[] = $querystring;
  }
  // Set each pager link title
  if (!isset($attributes['title'])) {
    static $titles = NULL;
    if (!isset($titles)) {
      $titles = array(
        t('« first') => t('Go to first page'),
        t('‹ previous') => t('Go to previous page'),
        t('next ›') => t('Go to next page'),
        t('last »') => t('Go to last page'),
      );
    }
    if (isset($titles[$text])) {
      $attributes['title'] = $titles[$text];
    }
    else {
      if (is_numeric($text)) {
        $attributes['title'] = t('Go to page @number', array(
          '@number' => $text,
        ));
      }
    }
  }
  return l($text, $_GET['q'], $attributes, count($query) ? implode('&', $query) : NULL);
}