Pagination (/system/libraries/Pagination.php), .
OLD ( 146-153):
if ($CI->uri->segment($this->uri_segment) != 0)
{
$this->cur_page = $CI->uri->segment($this->uri_segment);
$this->cur_page = (int) $this->cur_page;
}
NEW:
else if-statement, , : page = 1.
if ($CI->uri->segment($this->uri_segment) != 0)
{
$this->cur_page = $CI->uri->segment($this->uri_segment);
$this->cur_page = (int) $this->cur_page;
}
else
{
$this->cur_page = 1;
}
OLD ( 175):
$this->cur_page = floor(($this->cur_page/$this->per_page) + 1);
NEW:
, /URI.
//$this->cur_page = floor(($this->cur_page/$this->per_page) + 1);
OLD ( 206):
$i = $uri_page_number - $this->per_page;
NEW:
.
$i = $uri_page_number - 1;
OLD ( 230):
if ($this->cur_page == $loop)
NEW:
URI, , .
if ($this->cur_page == $loop || ($this->cur_page == 1 && $this->cur_page == $loop))
OLD ( 238-247):
if ($n == '' && $this->first_url != '')
{
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close;
}
else
{
$n = ($n == '') ? '' : $this->prefix.$n.$this->suffix;
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close;
}
NEW:
URL- , .
if ($n == '' && $this->first_url != '')
{
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$loop.'">'.$loop.'</a>'.$this->num_tag_close;
}
else
{
$n = ($n == '') ? '' : $this->prefix.$n.$this->suffix;
$output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$loop.'">'.$loop.'</a>'.$this->num_tag_close;
}
OLD ( 256):
$output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page * $this->per_page).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
NEW:
1.
$output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.($this->cur_page + 1).$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close;
OLD ( 262):
$i = (($num_pages * $this->per_page) - $this->per_page);
NEW:
.
$i = $num_pages;
. , .
, :)
EDIT:
:
function test($start_from = 0)
{
$this->load->library('pagination');
$data = array();
$per_page = 3;
$total = $this->activity_model->count_by();
$config['base_url'] = base_url() . 'test';
$config['total_rows'] = $total;
$config['per_page'] = $per_page;
$config['uri_segment'] = 2;
$config['num_links'] = 2;
$config['use_page_numbers'] = TRUE;
$start = $per_page * ($start_from-1);
$data['follow'] = $this->activity_model->get($per_page, $start);
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
$this->load->view('front_end/test' ,$data);
}
$start, $per_page * ($start_from-1). $start .
, ( -1). , 10, $start = 10 *(2-1), 10, , 10,20,
, :)