Help CI Pagination not determining URI Segment |
[eluser]micha8l[/eluser]
I'm having trouble getting pagination to work. In the manual it says, "The pagination function automatically determines which segment of your URI contains the page number. If you need something different you can specify it." Okay, so I omit this preference, and then it does not determine the page number... so anyone know how it automatically determines the page number... is it by placement e.g., does the pagination segment need to be at the end or the URL like http://example.com/controller/action/page/1 or is it by the name given to the segment? Here's my code: Model Code: public function paginate_comments($base_url, $article_id, $per_page, $pending = 'no') View Code: <?php if(isset($comment_pagination) AND $comment_pagination): echo $comment_pagination; endif; ?> Controller Code: public function pending()
[eluser]micha8l[/eluser]
What I did was to always have /page/1 <- the pagination key/value at the very end of the URL. By doing this, we can use framework features to accurately determine its position: Code: $this->pagination->initialize(array( Much love, good night!
[eluser]Aken[/eluser]
The Pagination library automatically defaults to the third URI segment. If your segment differs from this, you should specify it in the Pagination config. The documentation should be updated to reflect this, since it doesn't really automatically detect anything. Just has a default. It may have been already in the dev environment for CI, I haven't checked. |
Welcome Guest, Not a member yet? Register Sign In |