| 5 pager.inc | theme_pager_link($text, $page_new, $element, $parameters = array(), $attributes = array()) |
| 6 pager.inc | theme_pager_link( |
| 7 pager.inc | theme_pager_link($variables) |
| 8 pager.inc | theme_pager_link($variables) |
Returns HTML for a link to a specific query result page.
Parameters
$text: The link text. Also used to figure out the title attribute of the link, if it is not provided in $attributes['title']; in this case, $text must be one of the standard pager link text strings that would be generated by the pager theme functions, such as a number or t('« first').
$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 the pager link.
Return value
An HTML string that generates the link.
Related topics
File
- includes/
pager.inc, line 380 - Functions to aid in presenting database results as a set of pages.
Code
<?php
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'], array('attributes' => $attributes, 'query' => count($query) ? implode('&', $query) : NULL));
}
?> Login or register to post comments
Comments
Pager links are empty
Hello,
Am having a real issue with my pager everywehere in my pages (including views, drupal content search , blocks...etc).
The problem is => the pager is present, but the links have no href value,
ex : my pager is in a page called 'domain.com/home' (wish is a view of multiple content fields), all the pager links pointed to domail.com/home, there is no ?page=x.
I checked the cach, the number of pager by page, and still can't find a solution.
Thx for any help,
Achraf