homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
Forum Library, Charter, Moderators: bill & werty

RSS, ATOM, and Related Technologies Forum

Display partial RSS/ATOM feed on my website
I need an excerpt of my most recent Blogger post to show on my website

 10:29 pm on Apr 8, 2009 (gmt 0)

I'm building a PHP website that will include a Blogger page so that my client can update that one page on his own at will. When he does create a new post, I want the title, first paragraph of his entry, and a "read more" link to be displayed on the site's homepage. I'm totally new to RSS/ATOM feeds and have no idea how to start. I found some "tutorials," but they didn't do exactly what I need. Can someone please help me? Thanks!



 12:39 am on Apr 9, 2009 (gmt 0)

This solutuion would probably work for you: Short guide to include RSS on your website [webmasterworld.com].


 8:08 am on Apr 9, 2009 (gmt 0)

Thanks Bill. That thread was a really good start, but I need some more specific help.

I can successfully pull every entry of my feed into my target page, but I need to greatly limit that. I only want the title and first paragraph of the newest entry to be displayed. If this is now a PHP question, let me know and I'll ask for help in the PHP forum. Thanks.


 8:23 am on Apr 9, 2009 (gmt 0)

Blogger defaults to full ATOM feeds doesn't it? Do they have a setting somewhere that could change that? I haven't used Blogger in quite a while.

You just need to get the feed generated the way you want. You could use something like Google's FeedBurner. They have a feature called Summary Burner that does this: "Offer a short summary of your hyperlink-free content and direct your subscribers to your Web site for the rest of the story."


 8:29 am on Apr 9, 2009 (gmt 0)

Blogger does create full ATOM feeds, but it also gives a RSS compatible version of the feed.

Blogger is actually a Google product and recommends FeedBurner. I'll check it out. Thanks!


 10:27 am on Apr 9, 2009 (gmt 0)

I really hate needing so much hand-holding, but I need some more help.

Here's what's happening so far: I create a RSS feed using Blogger. Blogger's feed gets pulled into FeedBurner and summarized. FeedBurner's feed gets pulled into my homepage.

There are only a couple things left to be tweaked. I need only the newest post to be displayed from the FeedBurner feed and I need the page to look for feed updates with every refresh. Thoughts?


 12:03 am on Apr 10, 2009 (gmt 0)

I'm afraid that's going to get into the realm of PHP and your page design. You may want to ask in our PFP forum [webmasterworld.com] about that function.


 12:11 am on Apr 10, 2009 (gmt 0)

I actually found a script that looks promising to help with displaying only the first entry and have a lead to configuring the cache to look for updated feeds more often. If I run into trouble, I'll ask on the PHP forum. Thanks for your help!


 6:13 pm on Apr 10, 2009 (gmt 0)

You can use RSS2HTML it is a free PHP script. Should to the job for you.


 9:19 pm on Apr 11, 2009 (gmt 0)

Thanks everyone for the help, but I found a solution on my own and here it is for anyone looking at this post later on.

1) Have your Blogger feed settings set to publish short summaries of your posts (default is full).

2) Download MagpieRSS (I used version 0.72) to your server and place its files in a directory called "magpierss" at the same directory level of the PHP page that will display your feed.

3) Copy/paste the code below into the PHP page that will display your feed:


define('MAGPIE_DIR', 'magpierss/');

$rss = fetch_rss( 'YourAbsoluteFeedURL/atom.xml' );

/* Uncomment the following line to see the object and array data returned. Good to see which other information has been processed by magpierss */
// echo "<pre>"; print_r($rss); echo "</pre>";

//display latest blog content:
$blog_title = $rss->channel[title];
$item = $rss->items[0];
$title = $item['title'];
$content = $item['summary'];
echo "<div class='latest_news' style='background-color: #ffffff;'>\n";
echo "<h3>$blog_title</h3>\n";
echo "<p><strong>$title</strong><br />$content...</p>\n";
echo "<p style='margin-bottom: 0px; text-align: right; padding-right: 50px;'><a href='#'>Read more &gt;&gt;</a>\n";
echo "</div>";


4) Change the echo portions of the code above to display your feed with whatever HTML you want.

5) Open "magpierss/rss_fetch.inc" and find line #350.

6) Change the "60*60" to equal how frequently (in seconds - default 1 hour) you want the feed to look for new posts. I set mine to 1*60 (1 minute).

Note) If you want to display other information (author, timestamp, etc.), un-comment the echo line in the code above to see what information is available.

That's it! I hope my time spent figuring all this out can be a benefit to someone else.

[edited by: j2trumpet at 9:43 pm (utc) on April 11, 2009]


 12:37 pm on Apr 12, 2009 (gmt 0)

That's excellent for reference j2trumpet. Thank you for posting that!

I hadn't use Blogger for a while, so it's good to know they offer those options on the feed.


 10:47 pm on Apr 12, 2009 (gmt 0)

Thanks! I gotta say I'm pretty pleased with the way my first RSS work turned out. I'd post a link here to show off the final product if it was allowed.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / RSS, ATOM, and Related Technologies
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved