2013-04-12 133 views
0

我已经配置在routes.php文件作为路径,在控制器笨分页路由问题

$route['job-history/(:num)'] = "customer/customer/jobhistory/$1"; 

和分页配置如下,

$this->load->library('pagination'); 
$config['per_page'] = 25; 
$config['total_rows'] = 100; 
$config['base_url'] = $this->config->item('base_url').'job-history'; 
$config["uri_segment"] = 2; 
$this->pagination->initialize($config); 
$page = ($this->uri->segment(2)) ? $this->uri->segment(3) : 0; 

及其表示404错误页面加载时,

www.example.com/job-history

它会工作,如果手动添加az像www.example.com/job-history/0这样的ero。

我如何可以加载www.example.com/job-history作为第一页。我的配置有什么问题。任何帮助,请

+0

@Cryode是正确的。你可以尝试通过使用'$ route ['job-history(/:num)'''='customer/customer/jobhistory $ 1''将两条路线合并成一条路线;''我没有测试它,但是给它一试。 –

回答

8

你需要的路线为单job-history段为好。

$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1'; 
$route['job-history'] = 'customer/customer/jobhistory'; 
+0

感谢您的帮助。它的工作:) – abhis

2

因为在route.php,你只对后它有一个号段并没有为您的网页的工作,历史上还没有这样的规则而已,它就会被重定向到404作业历史记录页面提及。

添加

$route['job-history'] = 'customer/customer/jobhistory'; 

$route['job-history/(:num)'] = 'customer/customer/jobhistory/$1'; 
+0

感谢您的帮助 – abhis