Hello,
Might as well make my first post usefull 🙂
why not use fopen, fwrite and fclose very simple to use. Looks like you might be making a cms for a flash mp3 player?
HEre is how I have done it.
Here is a short tutorial and then the code.
Make your xml file.
Lets call it. songs.xml
Make a new file, lets call it fopen.php this will be the code to open the xml file and then write the data from the form.
I create a variable liveconfig, then use that to store the name if the file IA m editng, this make it easy to use the same code to edit multiple files.
Code for fopen.php
<?php
$liveconfig = "shows.xml";
if ($op == "update" ) {
$fp = fopen($liveconfig, "w") or die("error writing to config file, please contact the admin\n");
$data = stripslashes($data);
fwrite ($fp, "$data");
fclose($fp);
if (file_exists($liveconfig)) {
$updated = 1;
echo ("data saved, <a href=\"javascript:history.go(-1)\">go back</a>");
}
}
?>
now we need to make a page that has the form field so we can edit the xml, and then also post the data to fopen.php
I made a new file called form.php
I also use the variable liveconfig in order to use the same code to edit multiple xml files.
<html>
<head>
<title>Edit XML</title>
<meta http-equiv="Content-Type" content="text/html;">
</head>
<body>
<form name="form1" method="post" action="fopen.php?op=update">
<textarea name="data" style="width:640px; height:300px">
<? include ($liveconfig); ?>
</textarea>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
then upload to server and chmod shows.xml so it writable by the webserver.
Then pull up form.php?liveconfig=shows.xml
edit the xml and hit save, you got a simple cms.
I prefer using my sql, but this is great for simple flash or html websites.
I hope this helps.