I don't know why, but I can't override pager on template.php. I have tried every possible solution given on drupal.org. Shouldn't it override theme_pager() using phptemplate_pager()? If that so why it doesn't work? It doesn't effect pager at all. I always get the default pager.

Comments

blockedmind’s picture

oh... it turns out views module has its own pager function now... overriding theme_pager() was enough in drupal 5. but i have to do more in drupal 6. lets see whether i can override theme_views_mini_pager() now...

DesignICU’s picture

Trying to do this too, thanks for posting your note: I was wondering about the same lack of response from my template.php. Did you eventually get it to work?

smmtss’s picture

Copy the theme_views_mini_pager() function from theme.inc in views module and paste it into template.php of your theme.

Then rename the function from theme_views_mini_pager() to mythemename_views_mini_pager() and clear the cache.

1ncipient’s picture

I want to override the full views pager and just add some extra classes. I don't want to recreate the full pager from the mini one. However, theme_views_mini_pager() is the only pager function in theme.inc in views.
Anyone got any ideas?

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!

komal.savla’s picture

I tried to override the full pager.
You can put either your theme name or phptemplate in the function

function [Theme_Name]_pager($tags = array(), $limit = 10, $element = 0, $parameters = array()) {
    global $pager_page_array, $pager_total;
    $page_prev = $pager_page_array[$element] - 1;
    $page_curr = $pager_page_array[$element] + 1;
    $page_next = $pager_page_array[$element] + 1;
      # get querystrings (except q="" and page="")
      $cgi = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
      $query = '';
        foreach ($cgi as $key => $val) {
          if ($key != 'page' && $key != 'q') {
            $query .= '&'. $key .'='. $val;
          }
       }
     $query = substr($query, 1);
    if ($pager_total[$element] > 1) {
      $output = '<div class="previous-next">';
        if ($pager_page_array[$element]!=0 )$output.= '<div class="previous-page"> <a href="?page='.$page_prev.'" class="previous active">Previous Step</a></div>';
      $output.= '<div class="previous-next-page">Page '.$page_curr.'/'.$pager_total[$element].'</div>';
      if ($page_curr!=$pager_total[$element])  $output.= '<div class="next-page"> <a href="?page='.$page_next.'" class="next active">Next Step</a></div>';
     $output.= '</div>';
   return $output;
}
}