开发者

CodeIgniter Pagination with SimpleXML?

Here is what I have so far, from other sample code I found online. But its not working properly, its not showing me 5 items per page.

$feed[] = simplexml_load_file(‘feeds/file.开发者_如何学Cxml’);
$quantity = 5; // items to show per page.
$start = $this->uri->segment(3);
if(!$start) $start = 0;
$data[‘feed’] = array_slice($feed, $start, $quantity);
$config[‘base_url’] = base_url() . ‘welcome/feed/’;
$config[‘uri_segment’] = 3;
$config[‘num_links’] = 25;
$config[‘total_rows’] = count($feed);
$config[‘per_page’] = 5;
$this->pagination->initialize($config);
$data[‘pages’] = $this->pagination->create_links();

Any help would be good, thank you.


Change

$feed[] = simplexml_load_file(‘feeds/file.xml’);

to

$feed = simplexml_load_file(‘feeds/file.xml’);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜