On Sun, 20 Jul 2003 12:28:55 +0200, [EMAIL PROTECTED] (Merlin) wrote:
>Hi there,
>
>I was searching on the net for a while on how to create dynamic newsfeeds
>from my web portal. Somehow I did not find what I was looking for.
>
>Can anybody give me a good start on how to write a newsfeed service which is
>dynamic? The goal is whenever a member publishes a story on the site, it
>should be included into the newsfeed.
>
>Thanx for any suggestions and help on this!
Two ways of doing it, basically.
First is a dynamic PHP page that goes though the last ten or whatever
updates and displays them as RSS (in much the same way you display a
"recent articles" page, except you output XML instead of HTML)
Second is to create the page as above whenever you add a new story and
then output it to a static file.
Output of RSS is fairly simple, start off with
then build up the introductory data (I'm using a stripped down version
of my own feed as an example here):
http://purl.org/dc/elements/1.1/";>
Aquarionics
http://www.aquarionics.com
en-gb
Aquarion ([EMAIL PROTECTED])
Copyright 2003 Aquarion
2003-07-20T11:55:00+0100
http://www.aquarionics.com/epistula/?v=2.0.2b"; />
mailto:[EMAIL PROTECTED]"/>
daily
8
2000-01-01T12:00+00:00
If it's a database, query for the last 10 items, then loop though them
and output the code:
Journal - Aquarion and the Missing Domain
http://www.aquarionics.com/journal/2003/07/18/Aquarion_and_the_Missing_Domain
http://www.aquarionics.com/journal/2003/07/18/Aquarion_and_the_Missing_Domain
In which a server vanishes
http://www.aquarionics.com/journal/2003/07/18/Aquarion_and_the_Missing_Domain
2003-07-18T07:33:00+0100
computing
Finally, do the final closing tags:
and then run it though the Feed Validator at
http://feeds.archive.org/validator/ to make sure you haven't done
anything silly :-)
The specification for RSS2 (which will tell you - or help you - know
what goes in all the tags I used above) is at
http://blogs.law.harvard.edu/tech/rss
HTH
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php