codeigniter pagination: create links

时光怂恿深爱的人放手 提交于 2021-01-29 04:17:38

问题


I have this piece of code, which uses Codeigniter's native Pagination Class.

$this->load->library('pagination');
            $config['base_url'] = base_url().'notification/display_notification_info/'.$notification_id;
            $config['total_rows'] = $totalRows;
            $config['per_page'] = $per_page;
            $this->pagination->initialize($config);
            echo $this->pagination->create_links();

It shows the last page by default. So, the links are displayed like so:

< 1, 2, 3

It doesn't show the last page's URL. It should be:

 base_url/3

Where is my mistake?


回答1:


If your actual page is your last page by default, then it will not show a URL. But you can still to force it url to current page




回答2:


is the url correctly formed (yourdomain.com/notification/display_notification_info/'.$notification_id)? don't use base_url()..use site_url() try it

$config['base_url'] = site_url('notification/display_notification_info/'.$notification_id);


来源:https://stackoverflow.com/questions/21049350/codeigniter-pagination-create-links

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!