2012-09-05 3 views
1

컨트롤러에서 웹 서비스 $news = json_decode(@file_get_contents($submenu), true);의 뉴스 배열을 가져오고 있으며이 배열을 페이지 당 6 개의 뉴스로 페이지 매김해야합니다. 내 배열의 구조 :페이지 번호 배열 (DB가 아님) cakePHP

array(
    (int) 0 => array(
     'id' => '716', 
     'city_id' => null, 
     'language' => 'lit', 
     'header' => 'Lorem ipsum dolor sit amet.', 
     'description' => '<p>Sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna.', 
     'short_description_img' => '', 
     'autor' => 'Avio', 
     'friendly_link' => 'Lorem_ipsum_dolor_sit_amet_1346393036', 
     'created' => '2012-08-31 09:03:56', 
     'general_tag' => array(
      'id' => null, 
      'agency_id' => null, 
      'project_id' => null, 
      'active' => null, 
      'language' => null, 
      'title' => null, 
      'friendly_link' => null, 
      'healthcare_trip_tag' => null, 
      'created' => null 
     ), 
     'tags' => array() 
    ) 
     (int) 1 => array(
     'id' => '717', 
     'city_id' => null, 
     'language' => 'lit', 
     'header' => 'Lorem ipsum dolor sit amet.', 
     'description' => '<p>Sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna.', 
     'short_description_img' => '', 
     'autor' => 'Avio', 
     'friendly_link' => 'Lorem_ipsum_dolor_sit_amet_1346393036', 
     'created' => '2012-08-31 09:03:56', 
     'general_tag' => array(
      'id' => null, 
      'agency_id' => null, 
      'project_id' => null, 
      'active' => null, 
      'language' => null, 
      'title' => null, 
      'friendly_link' => null, 
      'healthcare_trip_tag' => null, 
      'created' => null 
     ), 
     'tags' => array() 
    ) 
     ................. 
) 

CakePHP 문서에 나와 있지만 행운을 보지 않은 기본 페이지 매김 방법. 조언을 주셔서 감사합니다

답변

1

copy cake/Controller/Component/PaginatorComponent.php에서 app/Controller/Component/PaginatorComponent.php까지 할 수 있습니다. 그 다음 페이지 매김 기능을 무시하십시오. 간단한 변경으로 배열 쪽 번호를 사용할 수 있습니다.