Welcome Guest, Not a member yet? Register   Sign In
pagination showing current page of total pages like " 1 of 2 1 2 Next
#1

[eluser]afsar[/eluser]
Hi friends ,

iam using codeigniter's pagination class. iam getting output like 1 2 3 Next Last »and so on. i would like to get the pagination as it is shown in this form pages like (1 of 30 1
2 3 Next Last » ) . i want to include current page of total pages + pagination links. How to do this . Please help
thanks in advance.
#2

[eluser]xwero[/eluser]
If you don't want to change the pagination class you need to calculate the two numbers in your controller. The current page number you can get from the url and the number of pages you can get from the total number of rows you add to the total_rows setting of the class.
#3

[eluser]afsar[/eluser]
hi, i used urisegment variable to get current page, and round($this->pagination->total_rows/$this->pagination->per_page) to get no.of pages.

thanks for help.
afsar
#4

[eluser]Unknown[/eluser]
Sorry to bump an old topic, but could someone please explain me what to modify to get the current page and total no. of pages?

I already use the build-in pagination, just want to view the current page and total no. of pages.
#5

[eluser]afsar[/eluser]
for total no.of pages use: $this->pagination->total_rows.
for current page, if you did not changed this setting $config['uri_segment'] = 3;, $current_pagenumber =$this->uri->segment(3);.
if you did not get what this post is suggesting, read other related examples for pagination, u will get the idea. it is simple to fix. you can, all the best.
#6

[eluser]Total Shop UK[/eluser]
You may want to round up the figures with ceil rather than round.
I had 4.4 pages which rounded my page count to 4 which was incorrect as it should have been 5.




Theme © iAndrew 2016 - Forum software by © MyBB