10-07-2011, 12:51 AM
[eluser]zenixgrace[/eluser]
I Don't exactly sure is a bug or not
i use CI v2.0.2
i got some issue wen't pass query_string minus value
seem like the digit links is not show in my page
example : i have a 12 rows and my configuration per_page is 4
i pass url like that http://localhost/CI/test/index/-1 or whatever that have a minus value
i got link like that < > (Just Only Prev and Next link show)
i try to fix pagination library code like that
search that code like that
replace with that
i also get an issue wen't i pass query_string value is my last record row
example : i have 12 row in database
my configuration is like that :
$config['base_url'] = site_url('test/index');
$config['total_rows'] = $this->testmodel->count_all();
$config['per_page'] = 4;
$this->pagination->initialize($config);
when i pass a url like that http://localhost/CI/test/index/12
i got link like that First < 2 3
i think it's should like that < 1 2 3 because the default num_link is 2
i try to fix pagination library code like that
search that code like that
replace with that
i don't exactly sure that the best way or not
may be someone can explain / fixed that with better ways..
Correct Me If I'm Wrong (CMIIW)
I Don't exactly sure is a bug or not
i use CI v2.0.2
i got some issue wen't pass query_string minus value
seem like the digit links is not show in my page
example : i have a 12 rows and my configuration per_page is 4
i pass url like that http://localhost/CI/test/index/-1 or whatever that have a minus value
i got link like that < > (Just Only Prev and Next link show)
i try to fix pagination library code like that
search that code like that
Code:
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
if ($CI->input->get($this->query_string_segment) != 0)
{
$this->cur_page = $CI->input->get($this->query_string_segment);
// Prep the current page - no funny business!
$this->cur_page = (int) $this->cur_page;
}
}
else
{
if ($CI->uri->segment($this->uri_segment) != 0)
{
$this->cur_page = $CI->uri->segment($this->uri_segment);
// Prep the current page - no funny business!
$this->cur_page = (int) $this->cur_page;
}
}
replace with that
Code:
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
{
if ($CI->input->get($this->query_string_segment) > 0)
{
$this->cur_page = $CI->input->get($this->query_string_segment);
// Prep the current page - no funny business!
$this->cur_page = (int) $this->cur_page;
}
}
else
{
if ($CI->uri->segment($this->uri_segment) > 0)
{
$this->cur_page = $CI->uri->segment($this->uri_segment);
// Prep the current page - no funny business!
$this->cur_page = (int) $this->cur_page;
}
}
i also get an issue wen't i pass query_string value is my last record row
example : i have 12 row in database
my configuration is like that :
$config['base_url'] = site_url('test/index');
$config['total_rows'] = $this->testmodel->count_all();
$config['per_page'] = 4;
$this->pagination->initialize($config);
when i pass a url like that http://localhost/CI/test/index/12
i got link like that First < 2 3
i think it's should like that < 1 2 3 because the default num_link is 2
i try to fix pagination library code like that
search that code like that
Code:
if ($this->cur_page > $this->total_rows)
{
$this->cur_page = ($num_pages - 1) * $this->per_page;
}
replace with that
Code:
if ($this->cur_page >= $this->total_rows)
{
$this->cur_page = ($num_pages - 1) * $this->per_page;
}
i don't exactly sure that the best way or not
may be someone can explain / fixed that with better ways..
Correct Me If I'm Wrong (CMIIW)