开发者

how to change block view pagination style

I previously posted this que开发者_JAVA技巧stion on drupal stackoverflow, but I didn't get any answers. I'm trying to make 2 different pagination styles. One for page views, and the other for block views. The block view should display image arrows for previous and next. I tried the following, but it changes both styles

function theme_pager_first($variables) {
  $text = $variables['text'];
  $text = "test123";
  $element = $variables['element'];
  $parameters = $variables['parameters'];
  global $pager_page_array;
  $output = '';

 // If we are anywhere but the first page
 if ($pager_page_array[$element] > 0) {
    $output = theme('pager_link', array('text' => $text, 'page_new' => pager_load_array(0, $element, $pager_page_array), 'element' => $element, 'parameters' => $parameters));
  }

  return $output;
} 


You could fudge something together with a bunch of theme override functions but really there's no need: you can just use good 'ol CSS.

Just create rules like this:

.block .pager-first a{display:inline-block;text-indent:-999em;background:url(/path/to/arrow.jpg) left top no-repeat;}
.block .pager-last a{display:inline-block;text-indent:-999em;background:url(/path/to/arrow.jpg) right top no-repeat;}

That will target just pagers that are inside a block, removing the next and previous text and adding your image in their place :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜