2013-07-28 3 views
4

나는 그 아래에있는 항목의 목록을 표시하는 범주 목록을 가지고 있습니다. 따라서추가 매개 변수로 페이지 매김 매개 변수를 전달하는 방법 cakephp?

:

노선이 : 나는 결과 페이지에서이 작업을 수행 할 때

Router::connect('/category/:slug', array('controller' => 'Product', 
      'action'=>'catview', 'slug'=> '[0-9a-zA-Z]+')); 
Router::connect('/category/:slug/:page', array('controller' => 'Product', 
      'action'=>'catview','slug'=> '[0-9a-zA-Z]+','page'=>'[0-9]+')); 

이, 그냥 작동하지 않습니다

<?php 
     $slug = $this->params['slug']; 
     $this->Paginator->options(array('url'=> array('controller' => 'Product', 
          'action'=>'catview','slug'=> $slug))); 

     echo $this->Paginator->prev('<< Show me previous', array('class'=>'prev')) 
     . $this->Paginator->next('Show me more >>', array('class'=>'next')); ?> 

그것은하지 않습니다 결과를 변경하면 1 페이지에서와 동일한 결과를 보여줍니다.

내가 잘못 가고있는 아이디어가 있습니까?

+0

가 nexrt/이전 링크에 어떤 URL을 지적 할 뷰 파일에서

$this->Paginator->options(array('url'=> array('controller' => 'Product', 'action'=>'catview','slug'=> $slug), 'convertKeys' => array('page'))); 

:

$this->paginate = array( //other stuff here 'paramType' => 'querystring' ); 

이 얹는? IME에서는 페이지 매김 변수에 params를 사용하는 것이 좋습니다. – AD7six

+0

'/ 계산기/2 '에서와 같이'/ : slug/: page'를 표시하고 있습니다. – Karma

+0

'/ 계산기/2'는 질문에있는 경로 중 하나와 일치하지 않습니다. – AD7six

답변

6

참고로 AD7six에게 감사드립니다.

내 컨트롤러가 있어야 :

관련 문제