2011-09-21 3 views
0

기사 모델과 범주 모델 모두에 url_slug 변수가 있습니다 (URL을 찾고자 할 때 URL에 무엇을 표시하고 싶습니다. 표시 : 당신은 당신의 통제에서이Kohana의 사용자 정의 중첩 된 경로 3

Route::set('articles', '/articles(/<category_filter>(/<article_id>))', array(
    'controller' => 'Articles', 
    'action' => '(index)' 
)) 
->defaults(array(
    'controller' => 'Articles', 
    'action'  => 'index', 
)); 

같은 경로를 사용할 수 있습니다

답변

0

나는 기사 컨트롤러 및/또는이를 달성하기 위해 경로를 설정하는 방법

//list all of the articles 
http://example.com/articles 

//list of all the articles in that category 
http://example.com/articles/:category_slug 

//a single article. 
http://example.com/articles/:category_slug/:article_slug 

를? 예를 들어,

$category = Request::current()->param('category_filter'); 
$article_id = Request::current()->param('article_id'); 

으로 필터/ID에 액세스 할 수 있습니다.