Pagination Fails After Adding URL Suffix to config.php |
[eluser]InvalidCharacter[/eluser]
Hi, yeah, yet another pagination thread. :-S I'm using CI 2.0. I had pagination working with the application/config/config.php set to; Code: $config['index_page'] = "index.php"; The pagination also worked fine after removing index.php with mod_rewrite/htaccess and leaving the suffix blank. It fails whenever I add in a suffix to the URL whether there is $config['index_page'] or not. Here is the method in the controller that works, which to me looks a little strange because the controller is accepting two vars, but the pagination fails when I add '$page_num' to $config['base_url'] for pagination. Code: public function userlist($archive = 1, $page_num = FALSE) { With the suffix enabled the URL looks like; Code: /index.php/admin/users/userlist/1.ext/5 Code: /index.php/admin/users/userlist/1/5
[eluser]LuckyFella73[/eluser]
I'm sure you can handle that by setting up the right routes for that page. Unfortunately I'm not good with regex stuff so I can't help you directly to solve that problem ..
[eluser]John_Betong[/eluser]
[quote author="LuckyFella73" date="1287516939"]I'm sure you can handle that by setting up the right routes for that page. Unfortunately I'm not good with regex stuff so I can't help you directly to solve that problem ..[/quote] It looks as though this problem has been overlooked and requires a debug report. I have just created a partial KLUDGE to overcome the problem. ./system/libraries/Pagination.php Code: // round about line 244 Further changes are required for the First and Last links and also a better solution would be to use $CI->config['url_suffix']
[eluser]reka[/eluser]
Quote:It looks as though this problem has been overlooked and requires a debug report.[/quote] can u tell me the detail,please... coz I don't understan your explanation
[eluser]John_Betong[/eluser]
[quote author="reka" date="1287589027"] Quote:It looks as though this problem has been overlooked and requires a debug report.[/quote] can u tell me the detail,please... coz I don't understan your explanation[/quote] Hi reka, When using setting '.config.config.php->config['url_suffix'] it is essential to use $this->load->helper('url')->anchor(...) function in order to get the url_suffixes to work correctly. The systemlibraries/Pagination.php file does not use the anchor function(). The links use <a href='...'>page_number</a> format. The changes I made was a quick Kludge to the library in order to get the Pagination links to work. Check the library file around line 244 and add the code $n .= '.html'; This line makes the page_number link work but does not fix the First and Last links. There are only so many hours in the day and the problem is on my Todo list
[eluser]reka[/eluser]
Quote:Hi reka, now even my url is look like this..... :ohh: http://localhost/codeigniter/main/all_post.html/5.html
[eluser]reka[/eluser]
thanks John_Betong my pagination is work right now... i just change my pagination config... before : $config['base_url'] = site_url('main/all_post'); after : $config['base_url'] = base_url().'main/all_post'; :lol: |
Welcome Guest, Not a member yet? Register Sign In |