2013-04-12 140 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