Welcome Guest, Not a member yet? Register   Sign In
Pagination Class Vs $config['url_suffix']
#1

[eluser]yemaw[/eluser]
Hi CI Gurus,

I try to use CI Pagination Class. I also want to use $config['url_suffix'] for my URL prefix. But both using Pagination Class and adding url suffix are conflicting in me.


Like this...

Orignal URL before using Pagination Class
http://localhost/ci/controller/function.html

After using Pagination and then ...
http://localhost/ci/controller/function.html/2

So,, CI don't know the second URL. Sad

I think url should be something like this.
http://localhost/ci/controller/function/2.html

If I don't add .html it's ok. but i want to add .html
But the third parameter may be still conflict with function parameters.

So is there any ways to use both Pagination class and url surfix?

Thanks
#2

[eluser]toopay[/eluser]
add...
Code:
$config['suffix']='.html';
at pagination config.
#3

[eluser]asantana66[/eluser]
I think you must use $config['uri_segment'] param to tell to the pagination class which segment it must put the page info.
#4

[eluser]Aken[/eluser]
You can add a route to accept/redirect the function.html/2 URI structure, if you're willing to accept that.

Code:
$route['controller/function.html/:num'] = 'controller/function';

Or, you can set your pagination's base_url to something that won't automatically add the extension, and specify the suffix, to achieve the controller/function/2.html URI.

Code:
$pag_config['base_url'] = site_url() . '/controller/function';
$pag_config['suffix'] = '.html';




Theme © iAndrew 2016 - Forum software by © MyBB