I need to make a feed. The feed will be on a dynamic site and should update on a regular basis. The feed have to collect the newest articles from the database and ping the articles to different sites. In short the feed should work like the default wordpress feed. how can I make this? Thanks. Green rep to good answers
I can advise you on the first part. Some things I'd say: - Mod_rewrite (optional) to rewrite feed.xml to feed.php You don't have to use an XML parser. I suggest you run some simple queries, something like this would fetch the last 10 entires into a table providing you have an `id` column (and it's primary key + auto_increment): $query = "SELECT * FROM `mytable` ORDER BY `id` DESC LIMIT 10;"; PHP: Output some kind of header: <?xml version="1.0" encoding="UTF-8"?> <channel> <title>SOME_TITLE</title> <link>YOUR_URL</link> <description>DESCRIPTION</description> <pubDate>DATE [ Output in a specific format ]</pubDate> <generator>Another_URL</generator> <language>en</language> <!-- en = english --> HTML: Loop though your data: $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)){ // Output something like this: /* <item> <title>TITLE</title> <link>LINK</link> <comments>COMMENTS_URL</comments> <pubDate>DATE</pubDate> <dc:creator>CREATOR</dc:creator> <category><![CDATA[CATEGORY]]></category> <guid isPermaLink="false">URL</guid> <description><![CDATA[DESCRIPTION]]></description> <content:encoded><![CDATA[HTML_DESCRIPTION]]></content:encoded> <wfw:commentRss>LINK</wfw:commentRss> </item> */ } PHP: Then a footer: </channel> </rss> HTML: I hope this gets you started Jay
Thanks for trying to help me jayshah. My knowledge on php comes to short here. I dont understand how to make that code. I think i have to pay someone to fix this for me. Anyone?