CodeIgniter Forums
Pagination w/ Query Strings Enabled (Is this the correct way) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Pagination w/ Query Strings Enabled (Is this the correct way) (/showthread.php?tid=40566)



Pagination w/ Query Strings Enabled (Is this the correct way) - El Forum - 04-12-2011

[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);



Pagination w/ Query Strings Enabled (Is this the correct way) - El Forum - 04-12-2011

[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


Pagination w/ Query Strings Enabled (Is this the correct way) - El Forum - 04-12-2011

[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


Pagination w/ Query Strings Enabled (Is this the correct way) - El Forum - 04-12-2011

[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 ?