Welcome Guest, Not a member yet? Register   Sign In
Pagination w/ Query Strings Enabled (Is this the correct way)
#1

[eluser]blasto333[/eluser]
I am in the customers controller with query string enabled. Would this be the correct way to setup pagination. (It appears to work)

Code:
$config['base_url'] = site_url('?c=customers&m=index');
$config['total_rows'] = $this->Customer->count_all();
$config['per_page'] = '20';
$this->pagination->initialize($config);
#2

[eluser]j4zzyh4ck3r[/eluser]
[quote author="blasto333" date="1302654128"]I am in the customers controller with query string enabled. Would this be the correct way to setup pagination. (It appears to work)

Code:
$config['base_url'] = site_url('?c=customers&m=index');
$config['total_rows'] = $this->Customer->count_all();
$config['per_page'] = '20';
$this->pagination->initialize($config);
[/quote]

I think u should use site_url('[your_controller]?c=customers&m=index'),
becoz if u use last code the url will be localhost/[project_folder]/index.php/?c=customers&m=index... just put your controller class name in the site_url even if u had set the default route to your current controller Smile
#3

[eluser]blasto333[/eluser]
[quote author="j4zzyh4ck3r" date="1302679770"][quote author="blasto333" date="1302654128"]I am in the customers controller with query string enabled. Would this be the correct way to setup pagination. (It appears to work)

Code:
$config['base_url'] = site_url('?c=customers&m=index');
$config['total_rows'] = $this->Customer->count_all();
$config['per_page'] = '20';
$this->pagination->initialize($config);
[/quote]

I think u should use site_url('[your_controller]?c=customers&m=index'),
becoz if u use last code the url will be localhost/[project_folder]/index.php/?c=customers&m=index... just put your controller class name in the site_url even if u had set the default route to your current controller Smile[/quote]

Why would I need the controller name twice when it is already defined in c=XXX
#4

[eluser]j4zzyh4ck3r[/eluser]
[quote author="blasto333" date="1302680322"][quote author="j4zzyh4ck3r" date="1302679770"][quote author="blasto333" date="1302654128"]I am in the customers controller with query string enabled. Would this be the correct way to setup pagination. (It appears to work)

Code:
$config['base_url'] = site_url('?c=customers&m=index');
$config['total_rows'] = $this->Customer->count_all();
$config['per_page'] = '20';
$this->pagination->initialize($config);
[/quote]

I think u should use site_url('[your_controller]?c=customers&m=index'),
becoz if u use last code the url will be localhost/[project_folder]/index.php/?c=customers&m=index... just put your controller class name in the site_url even if u had set the default route to your current controller Smile[/quote]

Why would I need the controller name twice when it is already defined in c=XXX[/quote]

Sorry, I forgot U'r using query strings, the code above should work, is there anything wrong in your output ?




Theme © iAndrew 2016 - Forum software by © MyBB