tags:

views:

34

answers:

1

HI, I shall finish some edits on drupal projet, that was done by another programmer (i have no contact of him). I'm newbie and I try to find out how the PAging module works. There are no numbers of pages showing. I suppose he changed the code. I found a file pager.php in projet's own theme with this function, that is probably doing the paging.

function _my_pager_link($page, $text, $class, $title) {
$query = array();
$query[] = drupal_query_string_encode(array(
    'page' => implode(',', $page)), array());
$querystring = pager_get_querystring();
if ($querystring != '') {
    $query[] = $querystring;
}
$attributes['title'] = $title;
$attributes['class'] = $class;
return l("<span>$text</span>", $_GET['q'], array('html' => TRUE,
    'attributes' => $attributes,
    'query' => count($query) ? implode('&', $query) : NULL));
}

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

$curr = $pager_page_array[$element];
$total = $pager_total[$element];
$output = '';
if ($total > 1) {
    $output .= '<div class="pager">';
    if ($curr > 0) {
        $page_new = pager_load_array($curr - 1, $element, $pager_page_array);
        $output .= _my_pager_link($page_new, t('‹ previous'), 'pager-prev', t('Go to previous page'));
    }
    if ($curr < $total - 1) {
        $page_new = pager_load_array($curr + 1, $element, $pager_page_array);
        $output .= _my_pager_link($page_new, t('next ›'), 'pager-next', t('Go to next page'));
    }
    $output .= '<div class="cleaner"></div>';
    $output .= '</div>';
    }
return $output;
}

Now there is just 'previous page' and 'next page' on the web. I would like it to be like this 'previous page '... 2 3 4 ... 'next page' How can I add the list of pages there? thank you

A: 

Copy and paste http://api.drupal.org/api/function/theme_pager/6

Add salt and voila!

Omar