RSS Feeds

Discussion in 'Web Design and Development' started by JavaWizKid, Jan 24, 2009.

  1. JavaWizKid macrumors 6502a

    Joined:
    Sep 18, 2008
    #1
    How can I create an automatic RSS feed that takes posts from a forum and places them on the homepage like MacRumors does?
     
  2. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #2
    Once you have the URL of the feed, you need two things on your web site:

    1) A place to display the content
    2) Code to open the feed, parse the feed, and display the feed

    In terms of #2, if you have a CMS or WordPress or forum software there are usually built in modules or plugins which allows you to setup each feed. Otherwise if you can run PHP, download rssreader.zip from this web page and follow directions. If you don't have server side coding, here is a super cool Javascript alternative that allows you to specify the feed criteria and it creates code you can copy/paste into your HTML. Just remember folks with Javascript disabled won't see the feed, of course.

    -jim
     
  3. JavaWizKid thread starter macrumors 6502a

    Joined:
    Sep 18, 2008
  4. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #4
    Depends on the software, obviously. For example phpBB has a Wordpress plugin and vBulletin has a bridge. What's your plan? I can't help much more than this based on what little information you've supplied.
     
  5. JavaWizKid thread starter macrumors 6502a

    Joined:
    Sep 18, 2008
    #5
    Basically what MacRumors does. Someone makes a post on a forum. It appears in the sidebar of the homepage.
     
  6. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #6
    The home page at http://www.macrumors.com/ is just a standard web page with content pulled from database such as recent posts, stats, and also RSS. It's not generated by the forum software, technically. So refer to my original answer and use one of the methods to update YOUR home page with feeds. That part is up to you, as the developer.

    In terms of vBulletin specifically, on any forum page including forum main index (but not the home page which is your own) vBulletin has something called an "RSS feed posting robot" through which RSS feeds from remote sources can be imported into your own board as threads or announcements, according to the documentation found here. Just an FYI that the feature exists, since we're talking about it.

    Note: To add vBulletin forum stats to your home page start with this simple hack outlined here on the official mods site where all such things can be found if you need further customization.

    Cheers.

    -jim
     
  7. notjustjay macrumors 603

    notjustjay

    Joined:
    Sep 19, 2003
    Location:
    Canada, eh?
    #7
    Funny enough, I am in the midst of a site redesign, which for me is a constant re-learning of PHP, and the current state of the web. I used a PHP script from this site:

    http://www.the-art-of-web.com/php/atom/

    (There are versions for Atom and RSS.)

    I'm using an Atom feed of a Blogspot page to put on my site, so that the latest few blog posts will be featured. I'm actually using it as a way to publish news and announcements.

    Update: Looks like I'll be switching to SimplePie so I can use a more generic RSS-handling script to do various different things around the site.
     
  8. brisbaneguy29 macrumors 6502

    brisbaneguy29

    Joined:
    Nov 27, 2007
    Location:
    Brisbane
    #8
    If your using Wordpress and want to display the posts on the homepage of your own site, you don't even need to muck around in RSS. Wack this code in the head section of the code:
    <?php
    // Include Wordpress
    define('WP_USE_THEMES', false);
    require('./blog/wp-blog-header.php');
    query_posts('showposts=2');
    ?>

    And stick this in HTML where you want the posts to show:
    <?php while (have_posts()): the_post(); ?>
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <a href="<?php the_permalink(); ?>">Read more...</a>
    <?php endwhile; ?>

    The page will have to be saved as a .php page, but works great. See my site for an example.
     

Share This Page