Welcome Guest, Not a member yet? Register   Sign In
Pagination: page not last part of uri
#1

[eluser]tsisson[/eluser]
I don't want to use the page as the last part of my uri while using the pagination class. Is this possible?

So the uri would be

Code:
http://site.com/page/phrase/

instead of

Code:
http://site.com/phrase/page/

and the pagination links are generated accordingly.


What would the $config['base_url'] be? Or what's the workaround?
#2

[eluser]TheFuzzy0ne[/eluser]
You can configure which segment the pagination library should use, however, it's ill-advised, since you may find yourself coming up against some unexpected design and implementation problems.
#3

[eluser]Colin Williams[/eluser]
Quote:$config['uri_segment'] = 3;

The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it.

"Automatically determines" is probably not the best wording in the user guide. What it means is that it expects the pagination offset to be the 3rd uri parameter. You'll want to set it to 2
#4

[eluser]tsisson[/eluser]
Maybe my question wasn't clear enough.

The problem are the pagination links. I don't know how they can be changed to the other format.
#5

[eluser]Colin Williams[/eluser]
Ah.. I read your example backwards. You're saying you want links like

Code:
http://site.com/10/phrase/
http://site.com/20/phrase/

Is this correct? If so, there is no configuration you can do that will work because you are going against convention. The pagination class always does $config['base_url']/$offset. Your best bet is to overload the Pagination class as needed to meet your needs.

You could also, I suppose, doctor up the result of Pagination::create_links() with some regex replaces, but that's messy and ass-backward. I'd stick with rolling your own version.
#6

[eluser]tsisson[/eluser]
Okay, thank you!




Theme © iAndrew 2016 - Forum software by © MyBB