2012-02-08 2 views
2

나는 라우팅이있는 블로그가 있습니다. 내 ini에서 다음과 같이 보입니다.젠드 프레임 워크 추가 페이지 - 매개 변수가있는 라우팅

routes.quote.route = :id 
routes.quote.defaults.module = default 
routes.quote.defaults.controller = posts 
routes.quote.defaults.action = single 
routes.quote.reqs.id = \d+ 

이제는 (덧글에 대한) 페이지 매개 변수가 추가로 필요합니다. 나는 다음과 같은 단락 경로를 만들어야 만합니다 :

routes.quotePage.route = :id/page/:page 
routes.quotePage.defaults.module = default 
routes.quotePage.defaults.controller = posts 
routes.quotePage.defaults.action = single 
routes.quotePage.reqs.id = \d+ 
routes.quotePage.reqs.page = \d+ 

나는이 둘을 하나에 결합하고 싶습니다. 내가 어떻게 할 수 있니? 페이지 매개 변수는 추가로만 사용해야합니다.

은 다음과 같이 당신에게

답변

-1

사용 Zend_Controller_Router_Route_Regex 감사합니다

routes.quote.route.type = "Zend_Controller_Router_Route_Regex" 
routes.quote.route = posts/(\d+)/(\d+) 
routes.quote.defaults.module = default 
routes.quote.defaults.controller = posts 
routes.quote.defaults.action = single 
routes.quote.map.1 = "id" 
routes.quote.map.1 = "page" 
-1

당신은

routes.quotePage.route = :id/:page 
routes.quotePage.defaults.module = default 
routes.quotePage.defaults.controller = posts 
routes.quotePage.defaults.action = single 
routes.quotePage.defaults.page = 1 
routes.quotePage.reqs.id = \d+ 
routes.quotePage.reqs.page = \d+ 

이 모두 http://domain.com/1http://domain.com/1/page/1 또는 http://domain.com/1/page/2

+0

'http : // domain.com/1/1'과'http : // domain.com/1/2' 만 일치시킵니다. –

0
일치 페이지 매개 변수에가 기본으로 값을 할당 할 수 있습니다

routes.quote.route = :id/*

routes.quote.route = :id

변경합니다.