Pagination, weird problem? |
[eluser]felixk[/eluser]
Hey, I can't get my pagination to work even though I've followed tutorials and the user_guide, I must be too tiered or something. Here's some code: Model Code: function All($num, $offset) Viewe Code: <?php foreach($query->result() as $row): ?> Controller Code: function index() Thankful for quick replies! //Felix Karlsson
[eluser]jrtashjian[/eluser]
It might be an issue with your $config['base_url'] setting. Try using site_url() instead of base_url(). Also, count the number of segments after index.php and add 1. That is the segment you want for your $config['uri_segment']. Let me know how that works out for you! - JR
[eluser]felixk[/eluser]
No it doesn't work :S The error after clicking this link: http://localhost/jobb/Fredag/index.php/blogg/4 Quote:404 Page Not Found I've changed to site_url(), and the uri_segment should be set to 2, right?
[eluser]jrtashjian[/eluser]
I am assuming 'blogg' is the controller? You need to specify the method you are using in your controller. Right now, Codeigniter is looking for the method '4' in controller 'blogg'. Set you url like so: Code: site_url('/blog/index/');
[eluser]felixk[/eluser]
Oh, of cource ![]() Now I don't get an error message, but it still don't work properly. ![]() When I click "2", the url is http://localhost/jobb/Fredag/index.php/blogg/index/4, but the entries showing are still the same as before. No matter what i change the 3rd segment to, the output is the same.
[eluser]jrtashjian[/eluser]
Is the offset for your function $this->blogModel->All() set to the correct URI as well? Code: $this->blogModel->All($config['per_page'], $this->uri_segment(3));
[eluser]jrtashjian[/eluser]
haha. I do it all the time too! Glad it's finally working! |
Welcome Guest, Not a member yet? Register Sign In |