在控制器中,我从网络服务中获取了一系列新闻 $news = json_decode(@file_get_contents($submenu), true);
,我需要将此数组分页为每页 6 条新闻。我的数组结构:
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 文档中显示的默认分页方法,但没有运气。感谢您的建议