Welcome Guest, Not a member yet? Register   Sign In
Pagination for SimpleXML ?
#1

[eluser]emcgfx[/eluser]
Ho can I add pagination to 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.xml');
$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.
#2

[eluser]emcgfx[/eluser]
Any one have any ideas ?




Theme © iAndrew 2016 - Forum software by © MyBB