[eluser]cchi[/eluser]
Hi peepz.. here's something I write to get the status of code Igniter pagination
Quote: Code:
function paging_status(){
$num_pages = ceil($this->total_rows / $this->per_page);
if ($this->total_rows == 0) { return ''; }
if ($this->cur_page == 0){ $this->cur_page = 1; }
if ($this->total_rows == 1){
return $status = 'FOUND: '.$this->total_rows.' RECORD(S) ON '.$num_pages.' PAGE(S). DISPLAYED: RECORD(S) 1 TO 1.';
}
if (!$this->total_rows) {
$first = 0;
}
else {
$first = $this->per_page * $this->cur_page - $this->per_page + 1;
}
if (!$this->total_rows) {
$last = 0;
}
elseif ($this->cur_page == $num_pages) {
$last = $this->total_rows;
}
else {
$last = $this->per_page * $this->cur_page;
}
$status = 'FOUND: '.$this->total_rows.' RECORD(S) ON '.$num_pages.' PAGE(S). DISPLAYED: RECORD(S) '.$first.' TO '.$last.'.';
return $status;
}
OUTPUT:
FOUND: 7 RECORD(S) ON 4 PAGE(S). DISPLAYED: RECORD(S) 5 TO 6.
>>Hope it help some lost soul out there..
>>if u have question just email me' I'd be glad to lend some help' :-)
>>
[email protected]
>>http://checalicdan.blogspot.com/