Welcome Guest, Not a member yet? Register   Sign In
pagination with negative number in url
#1

[eluser]scornaky[/eluser]
Hi friends,
I have one question regarding pagination:

What if in URL is used a negative number?

Configuration:
Code:
$config = array();
$config["base_url"] = $this->uri->segment(1)."?action=";

$config['page_query_string'] = TRUE;
$config['query_string_segment'] = 'page';

$config["total_rows"] = 100;
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$config['use_page_numbers'] = TRUE;
$config["num_links"] = 9;

$this->pagination->initialize($config);
$view_data['pagination'] = $this->pagination->create_links();

User case:

1) Page number is higher than total numbers of pages
Ex: 40 : show page number = 10 correct(in URL: ?action=&page=40)

2) Link to page 1: show page 1 correct(in URL: ?action=&page;=)

3) Using a negative number in URL: -10 : show :< > Last ›; and that's incorrect

There`s something missing in my configuration?

I want to use standard Codeigniter and nothing more:

In system/pagination

Line 179:
Code:
if ( ! is_numeric($this->cur_page))
  {
   $this->cur_page = $base_page;
  }
A solution can be

Code:
if ( ! is_numeric($this->cur_page)||($this->cur_page<=0))
  {
   $this->cur_page = $base_page;
  }
It's correct what I'm saying or is something else ( I misunderstood)....
#2

[eluser]jairoh_[/eluser]
[quote author="scornaky" date="1381319044"]Hi friends,
I have one question regarding pagination:

What if in URL is used a negative number?

Configuration:
Code:
$config = array();
$config["base_url"] = $this->uri->segment(1)."?action=";

$config['page_query_string'] = TRUE;
$config['query_string_segment'] = 'page';

$config["total_rows"] = 100;
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$config['use_page_numbers'] = TRUE;
$config["num_links"] = 9;

$this->pagination->initialize($config);
$view_data['pagination'] = $this->pagination->create_links();

User case:

1) Page number is higher than total numbers of pages
Ex: 40 : show page number = 10 correct(in URL: ?action=&page=40)

2) Link to page 1: show page 1 correct(in URL: ?action=&page;=)

3) Using a negative number in URL: -10 : show :< > Last ›; and that's incorrect

There`s something missing in my configuration?

I want to use standard Codeigniter and nothing more:

In system/pagination

Line 179:
Code:
if ( ! is_numeric($this->cur_page))
  {
   $this->cur_page = $base_page;
  }
A solution can be

Code:
if ( ! is_numeric($this->cur_page)||($this->cur_page<=0))
  {
   $this->cur_page = $base_page;
  }
It's correct what I'm saying or is something else ( I misunderstood)....[/quote]
ans.
1,2 and 3. then set the page number as the first page or 0.




Theme © iAndrew 2016 - Forum software by © MyBB