pager_link

Versions
4.6
pager_link($from_new, $element, $attributes = array())

Format a link to a specific query result page.

Parameters

$from_new The first result to display on the linked page.

$element An optional integer to distinguish between multiple pagers on one page.

$attributes An associative array of query string parameters to append to the pager link.

Return value

An HTML string that generates the link.

▾ 4 functions call 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.

Code

includes/pager.inc, line 382

<?php
function pager_link($from_new, $element, $attributes = array()) {
  $q = $_GET['q'];
  $from = array_key_exists('from', $_GET) ? $_GET['from'] : '';

  foreach ($attributes as $key => $value) {
    $query[] = $key .'='. $value;
  }

  $from_new = pager_load_array($from_new[$element], $element, explode(',', $from));
  if (count($attributes)) {
    $url = url($q, 'from='. implode($from_new, ',') .'&'. implode('&', $query));
  }
  else {
    $url = url($q, 'from='. implode($from_new, ','));
  }

  return check_url($url);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.