SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Nov 2000
    0 Post(s)
    0 Thread(s)

    RSS Working but questions

    Hi all,

    I followed a tutorial to setup an RSS Feed and it's all working ok, I wanted to add more than the title and content but haven't been able to work it out and now I'm not even sure if I'm doing the right thing.

    This is my test feed:

    This is the code:
    header("Content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?> ";
    // Set RSS version.
    echo "
    <rss version=\"2.0\"> ";
    // Start the XML.
    echo "
    <title>News From Around The World</title>
    <description>News and Information from all over the web brought to you by</description>
    // Create a connection to your database.
    // Query database and select the last 10 entries.
    $data = mysql_query("SELECT * FROM rssfeeds ORDER BY NewsID DESC LIMIT 10");
    while($row = mysql_fetch_array($data))
    // Continue with the 10 items to be included in the <item> section of the XML.
    echo "
    <guid isPermaLink=\"true\">".$row[NewsID]."</guid>
    echo "
    What I was thinking was to add the source of the news as a link. I have the field 'Source' in my database and that contains the links to the original stories.

    Now I'm not sure if this additional info should go into the feed or whether it should be on a new page. One that's formatted using XHTML/CSS etc?

    Should the feed only show the Title and Content as it currently is?

    Thanks in advance

  2. #2
    SitePoint Evangelist
    Join Date
    May 2006
    0 Post(s)
    0 Thread(s)
    The <source> tag is supposed to be like this: <source url="">SitePoint</source>

    Note, however, that, seeing as it's just an XML document, the user agent is free to generate the layout for the feed itself (including not showing the source).


Posting Permissions

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