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.
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 