help creating rss feed

Discussion in 'XML & RSS' started by cgo85, Apr 10, 2008.

  1. #1
    I've been reading and trying to follow tutorials on how to build an rss feed for my website which is database driven (mysql + php). For some reason I can't get this script to validate:

    <?php
    header("Content-type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

    echo "
    <rss version=\"2.0\">";

    echo "
    <channel>
    <title>abc.net Feed</title>
    <description>The best way to receive up to the minute real estate updates</desciption>
    <link>http://www.abc.net/</link>";

    require("config.php");
    require("opendb.php");

    //query database and select the last 10 entries
    $data = mysql_query("SELECT * FROM demographic ORDER BY cityurl DESC LIMIT 10");//MAY HAVE TO COMEBACK AND CHANGE 'id'
    while($row = mysql_fetch_array($data))
    {
    //Convert DB images data into actual image link
    $row[cityurl] = str_replace("images/","http://www.abc.net/images/",$row[cityurl]);

    //Continue with the 10 items to be included in the <item> section of the XML.
    echo "
    <item>
    <link>http://www.abc.net/city.php?state=".$row[state]."&".$row[countyurl]."&".$row[cityurl]."</link>
    <guid isPermaLink=\"true\">http://www.abc.net/city.php?state=".$row[state]."&".$row[countyurl]."&".$row[cityurl]."</guid>
    <title>".$row[city."</title>
    <description><![CDATA[".$row[Intro."]]></description>
    <comments>None</comments>
    </item>";
    }

    echo "
    </channel>
    </rss>";
    ?>
     
    cgo85, Apr 10, 2008 IP
  2. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #2
    however if you validate the RSS feed you'll get detailed output about what is missing in your feed

    for example your namespace declaration might be missing
    something similar to ( adapted to your scripting syntax )

    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

    just have a look at the RSS 2.0 specs at

    http://cyber.law.harvard.edu/rss/rss.html#optionalChannelElements

    or use first a manual editor RSS howto to create a feed then validate and then convert that syntax into your php page
     
    hans, Apr 14, 2008 IP
  3. Aaron111

    Aaron111 Well-Known Member

    Messages:
    4,301
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Hans can you through me a rss feed for this site really quick ??? or guide me I can work with you on some of youre projects free I could really use the help im RSS irrelevant
     
    Aaron111, Apr 15, 2008 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    Aaron
    on my previous post below I gave you the link to my RSS howto
    that is very simple - specially if you follow the instructions and use the Firefox RSS editor plugin.

    Important is to know what data are REQUIRED to obtain validation and what fields are optional.

    start simple with required data only.
     
    hans, Apr 15, 2008 IP
  5. Aaron111

    Aaron111 Well-Known Member

    Messages:
    4,301
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Man im new to this I just want some one to create one then I follow trough on all my other sites can you do:: " I can Pay""
     
    Aaron111, Apr 15, 2008 IP
  6. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #6
    the RSS howto is for absolute newbies
    if that is TOO difficult .....
    may be a change of job??
    gardener or flower salesman ?

    I am NOT interested in $ - I have plenty of work - many MONTHS of work waiting to be completed - I still process images from last year march. thus I earn enough for me and all my daily charity projects from my own web site and related work!

    u just may need to learn to kick your OWN butt MUCH harder, sit down and learn to do from scratch.
    there are millions of times in your life things NO money ever can buy.
     
    hans, Apr 15, 2008 IP
  7. Aaron111

    Aaron111 Well-Known Member

    Messages:
    4,301
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    185
    #7
    Stil in search for help creating rss feed
     
    Aaron111, Apr 15, 2008 IP
  8. Maheshregg

    Maheshregg Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I think u want to display your rss feeds in your website likes Google news it displayes artical title, description and more for that u can use RSS reader for ur website otherwise u want only create RSS feeds just go to xul.fr for best tutorials and tools
     
    Maheshregg, Apr 28, 2008 IP
  9. devarts

    devarts Banned

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    is rss hard to do then cause this is something that am intrested in myself
     
    devarts, May 24, 2008 IP