note 82331 rejected from ref.simplexml by tularis
| From: | tularis@php.net | Date: | Sun, 06 Apr 2008 12:53:46 +0000 |
| Subject: | note 82331 rejected from ref.simplexml by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137979@lists.php.net to get a copy of this message | ||
Note Submitter: int dot cons dot adv at gmail dot com
----
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