I am struggling with RSS/XML code here. I want to read a blogger (blogspot) RSS feed. My PHP knowlegde is ok, but maybe this is to much to ask from myself.. Ik hope you guys are a lot smarter than me.
I already have some code :
Code of the items
<?php
$post = $_GET['post'];
$url = "http://mrexcelxl.blogspot.com/feeds/posts/default?alt=rss";
$rss = simplexml_load_file($url);
if (!isset ($post)) {
$items = $rss->channel->item;
foreach($items as $item)
{
$title = $item->title;
$link = $item->link;
$description = $item->description;
echo '<h3><u>'.$title.'</u></h3>';
echo '<p>'.$description.'</p>';
}
}
if (isset ($post)) {
$item = $rss->channel->item;
{
$title = $item->title;
$description = $item->description;
echo '<h3><u>'.$title.'</u></h3>';
echo '<p>'.$description.'</p>';
}
}
?>
Code of the menu
<?php
// Show number of items
$items = 10;
// Load rss
$rss = simplexml_load_file('http://mrexcelxl.blogspot.com/feeds/posts/default?alt=rss');
// show last items
for($i=0;$i<$items;$i+=1)
{
echo "<a href=?post=" . $rss->channel->item[$i]->title . "> <h3>{$rss->channel->item[$i]->title}</a></h3></a><br>";
}
?>
So.. I'd like to: Show about 250chars of 10 items on the webpage, with a 'read more' button. If click -> show full item. I'd like to show all the items in the menu. If click -> open item.
Very very easy I though.. but no...