2 Votes Vote

stuck at displaying a PHP paginator

Posted by topdog 403 days ago Questions| paginator page pages All

I'm trying to create a paginator. I have created a paginator class with properties you can see below. But now I'm trying to display the paginator, but I'm completely stuck on different loops (perhaps I should just go to bed :P) and stuff.

The important properties are:

windows_size // the amount of pages visible
num_pages // the total number of pages
current_page // the currently selected page

I have the following object:

o: (Paginator)
 ->item_count  : 295
   page_size   : 50
   window_size : 5
   num_pages   : 10
   current_page: 1
   first_index : 50

And I want to display:

[1] 2 3 4 5 ...

Or I have:

o: (Paginator)
 ->item_count  : 295
   page_size   : 50
   window_size : 5
   num_pages   : 10
   current_page: 5
   first_index : 50

... 3 4 [5] 6 7...

Or I have:

o: (Paginator)
 ->item_count  : 295
   page_size   : 50
   window_size : 5
   num_pages   : 10
   current_page: 9
   first_index : 50

... 6 7 8 [9] 10

How would I get this to be displayed?

END RESULTS (many thanks to: Wh1T3h4Ck5!)

http://pastebin.com/2KzL1Tn6

Originally asked by: PeeHaa on Stack Overflow

Discuss Bury


Who Voted for this Question