Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

XboxEvolved

macrumors 6502a
Original poster
Aug 22, 2004
807
1,001
So here is my problem.

here is my current feed: http://xboxevolved.e-mpire.com/rssfeed.php
http://xboxevolved.e-mpire.com/Xbox_Evolved_News.xml
here is the one I am working on.

What I am trying to accomplish is to get the .xml feed to auto-update every time a new story is posted on the site, something .php one can do already. The reason I would like to replace the .php one is because it is made a little sloppy, has compatilbity problems and I can't use it to autoupdate things such as facebook and twitter pages because it isn't strict xml.

The .php was done by my old programmer in a matter of a few minutes, the .xml I have been doing myself with a RSS making tool, but I am not sure how to automate it. All the news content is pulled from "section 1" as it reads in the php file. I simply need to figure out a way for it to do the same but on the .xml file. I am pretty sure I need to edit somethign in between <item> </item> tags and that I may need a seperate program or codes running on the site. Would anyone have any insight on how I can do this?
 

jakeOSX

macrumors regular
Mar 24, 2005
123
31
the automation will be the interesting part.

one way to do this is to stay with the PHP. you can have the output of a PHP file be formatted like an XML document. The output will be XML, even though the file is a PHP file.

the only issue with this can be that some XML readers will just dismiss the PHP file since it is PHP.

you could also have the PHP file write the XML file for you. Then you'll need a way to run the PHP file, cron job or something, so that the XML is updated.
 

notnek

macrumors 6502
Oct 25, 2007
327
0
i would just set the content type of your PHP file as XML and then print out an XML document.

PHP:
header("Content-Type: text/xml");
 

SrWebDeveloper

macrumors 68000
Dec 7, 2007
1,871
3
Alexandria, VA, USA
@OP

You might want to look at this excellent XML/RSS writer class written in PHP so you can integrate your content into a feed by writing your own code to pull the latest data as you see fit, then initiate the class and pass that data to it and use it to generate the actual feed.

Class that can generate RSS (Rich/RDF Site Summary) XML documents that are commonly used to distribute site feeds. It features:

- Extends the XML Writer class to generate human readable XML-RSS documents.
- Simplified definition of channel and item properties.
- Support to define optional channel graphic image and search form text input.
- Supports RSS specification versions 0.9, 0.91, 1.0 and 2.0 .
- Supports for use of namespace modules to extend document property set.
- Optional XSL stylesheet example to render automatically RSS documents as HTML pages in XML capable browsers.

The guy who wrote that class also wrote RSS reader classes with caching mechanisms if you opt to run this script outside of cron. Awesome stuff for a customized solution.

-jim
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.