MacResource
rss from dynamic page? - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: rss from dynamic page? (/showthread.php?tid=12315)



rss from dynamic page? - Marcello Santos - 05-28-2006

anyone know a way to generate valid rss files from dynamic (php/mysql) web pages? and if not, maybe we could say - rss from plain old html.


Re: rss from dynamic page? - Seacrest - 05-28-2006

Create a separate file called "indexrss.php" (or whatever)
Iterate over your mysql results and create the xml instead of html.
You will need to set the content type to xml with a header('Content-type: text/xml') directive.
Optionally, you can add to your HTML page's head section.


Re: rss from dynamic page? - The UnDoug - 05-28-2006

Ah, Seacrest...you make it all look so simple.

You are my web design hero! (really!)


Re: rss from dynamic page? - Marcello Santos - 05-29-2006

Seacrest is the champion, for sure.

But your humble servant doesn't quite understand the
header('Content-type: text/xml')
bit

if under normal circumstances, a file called feed.rss begins with:



do you mean that this should be placed on the first line, above those two lines?:
;


Re: rss from dynamic page? - Marcello Santos - 05-29-2006

eh

I figured it out...

this goes first:


then:
any queries/other php header stuff

then:

....

while deliberately leaving out this:



Re: rss from dynamic page? - Seacrest - 05-29-2006

All headers must be sent before any data is output to the browser, so yeah.