Re: Adaptive pagination

2009-12-24 Thread NeoWebTech
Hi Bruns!

Thanks for your ideas.

After reading your idea I think implementing myself this is not a big
thing as I thought :)

Thanks again...

On Dec 24, 10:17 am, Jeremy Burns jeremybu...@me.com wrote:
 This isn't a full answer but will hopefully help your thinking.

 You could build a custom element that includes some logic around the
 current page, which is reached via $paginator-current(). You could
 then build links to the previous (say) five pages and the next five
 pages, with some logic to make sure you don't go past the first or
 last page. Then you can prefix this with links to pages 1 and 2, and
 suffixed by the penultimate and last page.

 The $paginator-numbers() function can take a 'modulus' option that
 determines how many pages to show either side of the current page,
 which will sort that part out for you;

 echo $paginator-numbers(array('modulus' = 4, 'separator' = '|'));

 I notice that although the document says modulus determines how many
 pages to show either side of the current page it is actually the total
 number of pages.

 Here's a rough attempt for you. This doesn't include any logic around
 $paginator-current(), but I am sure you can weave that in. Place this
 in a file called pagination.ctp in views/elements and drop it into a
 view

 ?php
         $paginator-options(array('update' = 'content', 'indicator' =
 'working'));

         echo 'div class=pagingdiv id=page-numbers';

                 echo $paginator-first('');
                 echo 'nbsp;';
                 echo $paginator-prev('');
                 echo 'nbsp;';

                 echo $paginator-numbers(array('modulus' = 4, 'separator' = 
 ' '));

                 echo 'nbsp;';
                 echo $paginator-next('');
                 echo 'nbsp;';
                 echo $paginator-last('');

         echo  '/div/div';

 ?

 I hope that helps a bit.

 On Dec 23, 6:37 pm, NeoWebTech deva.in...@gmail.com wrote:



  Hello!

  I want to create a pagination for a huge/large number of items. But,
  the default pagination component is not good when the number of pages
  increases. So, I want to display like the following

  « Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 2789 2790 Next »

  Please, let me know if there is any plug-in/code available.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Adaptive pagination

2009-12-23 Thread NeoWebTech
Hello!

I want to create a pagination for a huge/large number of items. But,
the default pagination component is not good when the number of pages
increases. So, I want to display like the following

« Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 2789 2790 Next »

Please, let me know if there is any plug-in/code available.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Adaptive pagination

2009-12-23 Thread Jeremy Burns
This isn't a full answer but will hopefully help your thinking.

You could build a custom element that includes some logic around the
current page, which is reached via $paginator-current(). You could
then build links to the previous (say) five pages and the next five
pages, with some logic to make sure you don't go past the first or
last page. Then you can prefix this with links to pages 1 and 2, and
suffixed by the penultimate and last page.

The $paginator-numbers() function can take a 'modulus' option that
determines how many pages to show either side of the current page,
which will sort that part out for you;

echo $paginator-numbers(array('modulus' = 4, 'separator' = '|'));

I notice that although the document says modulus determines how many
pages to show either side of the current page it is actually the total
number of pages.

Here's a rough attempt for you. This doesn't include any logic around
$paginator-current(), but I am sure you can weave that in. Place this
in a file called pagination.ctp in views/elements and drop it into a
view

?php
$paginator-options(array('update' = 'content', 'indicator' =
'working'));

echo 'div class=pagingdiv id=page-numbers';

echo $paginator-first('');
echo 'nbsp;';
echo $paginator-prev('');
echo 'nbsp;';

echo $paginator-numbers(array('modulus' = 4, 'separator' = ' 
'));

echo 'nbsp;';
echo $paginator-next('');
echo 'nbsp;';
echo $paginator-last('');

echo  '/div/div';

?

I hope that helps a bit.

On Dec 23, 6:37 pm, NeoWebTech deva.in...@gmail.com wrote:
 Hello!

 I want to create a pagination for a huge/large number of items. But,
 the default pagination component is not good when the number of pages
 increases. So, I want to display like the following

 « Previous 1 2 … 5 6 7 8 9 10 11 12 13 … 2789 2790 Next »

 Please, let me know if there is any plug-in/code available.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en