SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Serving RSS?

  1. #1
    SitePoint Addict
    Join Date
    Jul 2004
    Location
    Brooklyn, NY
    Posts
    316
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Serving RSS?

    I have a custom blogging CMS that lacks RSS support... What can I do to add RSS support to the site?

    Basically I'm just looking for a way to serve an RSS feed. Unfortunately I don't know the technical term for "serving RSS" so Google wasn't very helpful.

    All suggestions are welcome.

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Location
    Toronto
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    take a look at
    http://feedcreator.org/

    I've used it in the past, pretty simple and it does the trick

  3. #3
    code ninja hamstu's Avatar
    Join Date
    Nov 2002
    Location
    Montréal, Canada
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The IBM Developer network also has a good PHP/RSS tutorial.

  4. #4
    SitePoint Wizard bronze trophy bigalreturns's Avatar
    Join Date
    Mar 2006
    Location
    The Wirral, England
    Posts
    1,293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not too tough to do, just need to serve the content with the right headers, here's the code that I use on my site
    PHP Code:
    <?php
    header
    ("Content-type: text/xml");
    echo (
    "<?xml version=\"1.0\"?>
    <rss version=\"2.0\">
      <channel>
        <title>Your RSS Title</title>
        <link>Your Site</link>
        <description>Describe your site</description>"
    );
        
    $dbh=mysql_connect ("host""user""password") or die ('I cannot connect to the database because: ' mysql_error());
    mysql_select_db ("database");


    $query=""//whatever query you need to get the required data
    $result=mysql_query($query);

    WHILE(
    $row=mysql_fetch_assoc($result)) {
                echo (
    "
                <item><title>" 
    htmlspecialchars($row['titlefield']) . "</title>

                <description>" 
    htmlspecialchars($row['descriptionfield']) . "</description>
                
                <link>http://www.waste-some-time.com/link/" 
    htmlspecialchars($row['linkfield']) . "
                </link>
                <guid>http://www.waste-some-time.com/link/" 
    htmlspecialchars($row['guidfield']) . "</guid>
                </item>"
    );
                }
            echo (
    "  
    </channel>
    </rss>"
    );
    ?>
    "The proper function of man is to live - not to exist."
    Get a Free TomTom



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •