0

I am creating a page with teaser of articles using views... In the Full pager, the default functionality is....

1 2 3 4 ... next >

when i click next now the next number gets highlightd like...

< prev ... 1 2 3 4 ... next >

and now when i again click next...

< prev ... 2 3 4 5 ... next >

the number set gets altered...

But what i actually need is...

1 2 3 4 next >

< prev 1 2 3 4 next >

< prev 1 2 3 4 next >

< prev 1 2 3 4 next >

and now when i click next...

< prev 5 6 7 8 next >

There are some modules like PAGERER to change the appearance of the core pager... But is there any to make this functionality or should I do some custom work...

2
  • Personally I think what you want is bad, from the UX point of view. And it is not any of the common pager types. So you probably will need to do your custom work. But for the sake of your users, I hope you will not.
    – Mołot
    Commented Aug 29, 2014 at 9:10
  • I do know it... but actually this is what they need me to do... Is there any way to do it... Commented Aug 29, 2014 at 9:12

2 Answers 2

1

You should be able to do this by implementing function [THEMENAME]_pager($variables) inside your theme. Default implementation is shown and described in function theme_pager() documentation.

1
  • 1
    Fine it worked... I did some math and made it done... now I am gonna proudly ask them "do you really need this??"... :) Commented Aug 29, 2014 at 11:32
2

I worked on it and found a result... actually Drupal core pager is user friendly enough but in case you need to alter it's functionality you need to edit variables in theme_pager() in your theme's template file.

To obtain the above functionality I altered some variables which are as follows...

$pager_first = (floor($pager_current / $quantity) * $quantity) + 1;

$pager_last = $pager_first + $quantity - 1;


if( $pager_current % $quantity == 0){
  $pager_first = $pager_current - $quantity +1;
  $pager_last = $pager_first + $quantity - 1;
}

I neglected $page_middle variable since I did not needed it...

Warning: Do this when its absolutely necessary...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.