Welcome Guest, Not a member yet? Register   Sign In
Pagination
#1

[eluser]4ever[/eluser]
Hi, I just try the pagination library. I did a table with hundreds of records and now trying to print them. This is my config:

Code:
function index(){
   $this->load->library('pagination');
   $config['base_url'] = "http://localhost/ci/page/index";  
   $config['total_rows'] = $this->db->get('messages')->num_rows();  
   $limit = $config['per_page'] = 10;  
   $config['num_links'] = 14;
   $offset = $this->uri->segment(3);
  
   $this->pagination->initialize($config);
      
   $data['records'] = $this->db->get('messages',$limit,$offset); // row limit from db  
   $this->load->view('messages_view',$data);  
  }

And I got this out put:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 > Last ›

But when I click on 11 then I got this output:
< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 > Last ›

Which is much more wider than the basic 15 links.

So I want to ask is this normal or is possible to set the pagination to not to be wider then the original list of links. That means I would like to see something like this:

< 8 9 10 11 12 13 14 15 16 17 18 > Last

When I click on then or maybe be it like so:

< 10 11 12 13 14 15 16 17 18 19 20> Last

I want just to say that is looks weird such behaviour


But next problem is
That when the number has more digits so it gets longer:
‹ First < 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 > Last ›
So this looks like it would to be good to make some change to the library to be it able to count with the numbers how many digits they have.

Guys,
do you have some idea how to compute this: how many digits does the number have?
#2

[eluser]InsiteFX[/eluser]
This is normal behavior, but you could create a MY_Pagination and extend it do what you want.

InsiteFX
#3

[eluser]4ever[/eluser]
[quote author="InsiteFX" date="1306457026"]This is normal behavior, but you could create a MY_Pagination and extend it do what you want.

InsiteFX[/quote]

I probably will do it. Just one more question. I noticed in tutorial that it is used table library to print out the table of articles... Is there any other way how to wrap the list of articles not in table but in any other block tags using divs or p tags? Is there any library to work similar like table but do the job with block elements? Or is there some reason why to use tables for this purpose and not the block elements?
#4

[eluser]4ever[/eluser]
The pagination library takes 8 Kb. I have this done in two simple functions with 38 lines 2,44 Kb. So I will use my own class - that seems to me as better solution.




Theme © iAndrew 2016 - Forum software by © MyBB