Welcome Guest, Not a member yet? Register   Sign In
pagination: no proper parameters
#1

[eluser]stoefln[/eluser]
ouch- another problem.
i have following code, copied out of the CI guide:

Code:
$config = array();
$this->load->library('pagination');

$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = '200';
$config['per_page'] = '20';

$this->pagination->initialize($config);
echo $this->pagination->create_links();
what i get are links like that
Code:
http://example.com/index.php/test/page/&per_page=20
but what i would want to get:
Code:
http://example.com/index.php/test/page/per_page/20
#2

[eluser]stoefln[/eluser]
ok i found a part of the answer:
i have set
Code:
$config['enable_query_strings'] = TRUE;
in my config.php.

but why cant i override this setting in my controller, just for my pagination, with
Code:
$config['enable_query_strings'] = FALSE;
#3

[eluser]fesweb[/eluser]
The problem is that the Pagination Class has an OR, where it should have an AND.

I had to copy the class into a new file in my application's /libraries/Pagination.php

Then, I found two places where I changed this:
Code:
if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
Tho this:
Code:
if ($CI->config->item('enable_query_strings') === TRUE AND $this->page_query_string === TRUE)

You shouldn't have to change anything else, as CI will load this file in the place of the core file.

Good luck.
Matt
#4

[eluser]taewoo[/eluser]
Good catch fesweb. I was banging my head for an hour trying to figure this out.
Reported this in CI bug tracking- http://codeigniter.com/bug_tracker/bug/6655/
#5

[eluser]fesweb[/eluser]
[quote author="taewoo" date="1233633257"]I was banging my head for an hour trying to figure this out.[/quote]
Only an hour?

You're lucky!
#6

[eluser]taewoo[/eluser]
Haha.. my skull must not be as thick as yourss




Theme © iAndrew 2016 - Forum software by © MyBB