Hi,

I'm referring to the API here http://api.drupal.org/api/function/theme_pager/6
I want to override the function so that I can wrap the pager with another DIV for styling.

But I cant seem to override it with my theme.

Copied the entire function theme_pager() to my template.php file. Cleared caches.
I'm only seeing 1 2 instead of 1 2 next >> last >>.
What could be wrong here?

Strangely, I tried with Garland and it worked.

Comments

DontRemember’s picture

Anybody?

Could it be something else overriding my theme's function?

jeanpierre’s picture

Let me know if you've solved the problem !!
Thanks.
--
Jean-Pierre

walker2238’s picture

I'm having the same problem, next, last, first and previous links don't appear.

feeper’s picture

Bump....

Same thing here. Designing custom theme and have inserted the code from drupal documentation in template.php. (Note: tried phptemplate_ and *mythemename*_). I am using Drupal 5.1....but if it is happening in both 5 and 6...what are we missing in our themes that is not documented??

function phptemplate_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
  global $pager_total;
  $output = '';

  if ($pager_total[$element] > 1) {
    $output .= '<div class="pager">';
    $output .= theme('pager_first', ($tags[0] ? $tags[0] : t('« first')), $limit, $element, $parameters);
    $output .= theme('pager_previous', ($tags[1] ? $tags[1] : t('‹ previous')), $limit, $element, 1, $parameters);
    $output .= theme('pager_list', $limit, $element, ($tags[2] ? $tags[2] : 9 ), '', $parameters);
    $output .= theme('pager_next', ($tags[3] ? $tags[3] : t('next ›')), $limit, $element, 1, $parameters);
    $output .= theme('pager_last', ($tags[4] ? $tags[4] : t('last »')), $limit, $element, $parameters);
    $output .= '</div>';

    return $output;
  }
}

Only shows the page numbers. Next, Previous, First and Last do not appear. Has anybody come with a solution to this? *Fingers Crossed*

jaypan’s picture

Lets see your query code.

Contact me to contract me for D7 -> D10/11 migrations.

feeper’s picture

Now see ... I didn't know I needed any of that...I thought I was using template.php to replace the way it displays what is already present in Drupal. I take it that I am mistaken :(

Any links to more information when it comes to using mytheme_pager() that shows how to set up the query??

I am only going to be using the pager for items in the node table.

walker2238’s picture

I'm not sure if this will help you guys but in the function I removed the <, <<, >, and >> characters from the next, first, you get idea and it showed up fine. However I'm not sure why.

yasir farooqui’s picture

Today I got this problem too, and its strange that just removing these characters solved the issue. I thing it may be only if we are using multi languages on our site, as in my case. But I am sure because I did not check it on a non multi lingual site.

Devr’s picture

Had also this problem. The template.php in my theme was ANSI, pager.inc is UTF-8 without BOM. I solved this by recode the special characters from UTF-8 without BOM to ANSI.

theabacus’s picture

For those who may be wondering how to recode the characters:

1) Open template.php in Notepad
2) Click "File > Save As"
3) Select "UTF-8" under "Encoding"

Fixed the problem for me.

nimazuk’s picture

Works like a charm but causes a major problem.
After this change I cannot submit any form in website. It goes to blank screen.

Nima

feeper’s picture

I should mention that this is what I found too.

1ncipient’s picture

this didn't work for me. I tried reencoding the pager code and slapping it in template.php and removing the special characters. I also tried using utf-8 for the template.php, it caused many issues across the site but still didn't solve the problem. Does anyone have any other suggestion?

theabacus’s picture

A very cumbersome solution but it does work:

- Keep the encoding unchanged on template.php
- Write the theme_pager() template override function in a separate file that is encoded UTF-8.
- Using PHP include the separate pager file into the template.php

Yes, very cumbersome. I hope there is a better solution or it is resolved in D7...

1ncipient’s picture

gah, as ridiculous as it may sound, and embarrassing to admit, i wasn't rebuilding the theme registry when i overrode [theme]_pager() .. don't forget to rebuild your theme registry!

jaypan’s picture

I think that's a mistake every single Drupal developer/themer learns the hard way. But after you learn it once, you never forget it again!

Contact me to contract me for D7 -> D10/11 migrations.