www.webdeveloper.com
Results 1 to 2 of 2

Thread: Add and edit XML with PHP

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Post Add and edit XML with PHP

    Hi there!

    Im currently working on a script which allows me to enter new posts in a XML-file.

    The XML ("config.xml") is read by a flash application to show videos. The XML-template is as follow, and is entered for each new movie I want to publish:
    Code:
          <item>
             <title>$title</title> // from form ($_POST)
             <description><![CDATA[$description]]></description> // short description of movie
             <url>$URL</url> // URL to the moviefile (FLV)
             <thumb>$thumb_url</thumb> // URL to thumbnail
          </item>
    I've created a short PHP-script which allows me to enter this details through a form. On the top and the bottom of the file there's a tag <movie> and </movie>, and using the fgets()-function with a "while", the script is searching for the first <movie>-line and place the new entery right below it.

    The source code can be found here: http://norskwebforum.no/pastebin/10961 (text in norwegian, but I think you'll understand the point).

    Now, I really want to add the functionality to edit and delete posts, but I don't know how to do this. Maybe I can generate the XML with a database, but I started with PHP two weeks ago, so I'm still pretty n00b at this. I've read about SimpleXML in PHP5 as a easier way of doing this, but at this point this is a little too complicated to understand...

    Summary: The point is to add, edit and delete items from the XML-file within a graphical interface.

    So any help would've been much appriciated!
    Last edited by Marjoth; 03-17-2009 at 11:48 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles