CodeIgniter routes and pagination adding “/page/” to all links -
i’ve implemented pagination following:
$this->load->library('pagination'); $perpage=10; $config['base_url'] = site_url().'news/page'; $config['total_rows'] = $this->news_model->getnews(array('count' => true)); $config['per_page'] = $perpage; $config['uri_segment'] = 3; $config['num_links'] = 8; $news = $this->news_model->getnews(array('limit' => $perpage,'offset'=>$offset)); $this->pagination->initialize($config); $data['pagination'] = $this->pagination->create_links(); $data['news'] = $news; $data['page'] = "news"; $this->load->view('index', $data); i’m using following routes:
$route["news"] = "news/news_list"; $route["news/page"] = "news/news_list"; $route["news/page/(:num)"] = "news/news_list/$1"; $route["news/detail/(:any)"] = "news/news_detail/$1"; the problem i’m facing although pagination working fine when go second page or other page after clicking on pagination links - of other links on page /page/ added in front of them -> /page/detail/aaaaaa route $route["news/detail/(:any)"] = "news/news_detail/$1"; can not identify detail link.
why /page/ added of links? need routes pagination?
your $config['base_url'] news/page, that’s why /page added links.
i don’t think need these routes pagination, if want them, should use these routes in $config['base_url'].
Comments
Post a Comment