I want to add script from my blog to my homepage so that on the front page viewers can see my recent blog entries. How do I do it?
Its quite easy with PHP SimpleXmlElement, heres an example <?php $url = "http://feeds2.feedburner.com/2raccoon"; $file = file_get_contents($url); $xml = new SimpleXmlElement($file); foreach ($xml->channel->item as $entry){ echo "<p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</p>"; } ?> PHP:
r u using wordpress or something else if you are using wordpress then u can manage easily.you can use rss Widgets
Script worked great, is it possible to limit number of posts that show. It shows 4 right now I only want two at a time?
$url = "http://feeds2.feedburner.com/2raccoon"; $file = file_get_contents($url); $xml = new SimpleXmlElement($file); $total = 2; $counter = 0; foreach ($xml->channel->item as $entry) { if(++$counter > $total) break; echo "<p><a href='$entry->link' title='$entry->title'>" . $entry->title . "</p>"; } PHP:
I am also having trouble with limiting the number of links for my rss feed. I use the same code as above, but how do I get only 3 different articles to show at a time?