note 82331 added to ref.simplexml

From: Date: Sun, 06 Apr 2008 10:49:10 +0000
Subject: note 82331 added to ref.simplexml
Groups: php.notes 
Request: Send a blank email to php-notes+get-137974@lists.php.net to get a copy of this message
Hello, i'm totally newbie in php and xml, i am trying to use simple xml, and got a problem with splitting the content onto multiple page. I read several documentation and tutorial page but i can't get a working code. Here is my actual code: <?php $request_url = "http://************/feed.xml"; $xml = simplexml_load_file($request_url) or die("feed not loading"); foreach ($xml->channel as $channel) { foreach ($channel->item as $item) { ?> <table align="center" width="50%" border="2" cellpadding="2"> <tr> <td><a href="<?php printf($item->link); ?>" target="_blank"><strong><?php printf($item->title); ?></strong></a></td> </tr> <tr> <td> <?php printf($item->description); ?> </td> </tr> </table> <?php } } ?> this work great at showing all the xml feed. But this feed is quite huge, i got more than 100 items in it. What i would like is to create several pages and limit the number of items on each page to 10. Can anybody give me some example of the code i should use on page 1 (items from 1 to 10) and on page 2 (items from 11 to 20)? thanks a lot ---- Server IP: 69.147.83.197 Probable Submitter: 88.82.46.218 ---- Manual Page -- http://www.php.net/manual/en/ref.simplexml.php Edit -- https://master.php.net/note/edit/82331 Del: integrated -- https://master.php.net/note/delete/82331/integrated Del: useless -- https://master.php.net/note/delete/82331/useless Del: bad code -- https://master.php.net/note/delete/82331/bad+code Del: spam -- https://master.php.net/note/delete/82331/spam Del: non-english -- https://master.php.net/note/delete/82331/non-english Del: in docs -- https://master.php.net/note/delete/82331/in+docs Del: other reasons-- https://master.php.net/note/delete/82331 Reject -- https://master.php.net/note/reject/82331 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137974) next »