RSS feed editor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

RSS feed editor

Post by papa »

Hi,

I'm currently making an attempt of doing an RSS feed.

With my extensive PHP skills I managed to read the xml file and output my latest news.

What I want to do now is a function that adds a new news item to my xml file, which I later can implement to my other functions on the site (if I add a song it will update the xml file for example).

I need help with the initial design for the xml file update:

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">
<channel>
  <title>Craven-Studio.com</title>
  <link>http://www.craven-studio.com/</link>
  <description>Music studio, web design, art</description>
   <item>
    <title>Site Structure 1.0</title>
    <link>http://craven-studio.com/articles.php?id=5</link>
    <description>New article, Site Structure 1.0 added</description>
    <pubDate>2008-10-21</pubDate>
  </item>
   <item>
    <title>Newsfeed added</title>
    <link>http://www.craven-studio.com/about_rss.php</link>
    <description>Newsfeed functionality added</description>
    <pubDate>2008-10-21</pubDate>
  </item>
  <item>
    <title>How I mix</title>
    <link>http://www.craven-studio.com/articles.php?id=1</link>
    <description>New article, How I mix added</description>
     <pubDate>2008-10-01</pubDate>
  </item>
</channel>
</rss>
The direction I am going for now is to read the first portion of the file into a variable and then read the rest of the file to variable2. Inserting my new item between those and write back to the file.

Is that the way to go or is there I better aproach?

thanks
Post Reply