1
在控制器中,我從Web服務$news = json_decode(@file_get_contents($submenu), true);
獲得一系列新聞,我需要將此數組分頁到每頁6條新聞。我的陣列的結構:分頁數組(不是來自數據庫)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文檔中顯示的默認分頁方法,但沒有運氣。感謝您的建議