View Full Version : simple editor question
egoldy
November 16th, 2004, 08:27 PM
hi.everyone.
I have a question about kirupa xml tuts:
http://www.kirupa.com/web/xml/examples/simpleeditor.htm
The simpleeditor doesn't work fine on my site.
http://webstudio.com.cn/seditor/simple_editor.html
I think the simple_save.php is not work.
http://webstudio.com.cn/seditor/simple_save.php
<?php
$filename = "simple_edit.xml";
$raw_xml = file_get_contents("php://input");
print $raw_xml;
$fp = fopen($filename, "w");
fwrite($fp, $raw_xml);
fclose($fp);
?>
my phpinfo:
http://webstudio.com.cn/seditor/phpinfo.php
If my php version is low. how can I rewrite simple_save.php?
Please help me .I needed it.
Thanks a lot.
λ
November 17th, 2004, 02:22 AM
if (!function_exists('file_get_contents'))
{
function file_get_contents($filename, $use_include_path = 0)
{
$file = @fopen($filename, 'rb', $use_include_path);
if ($file)
{
if ($fsize = @filesize($filename))
{
$data = fread($file, $fsize);
}
else
{
while (!feof($file))
{
$data .= fread($file, 1024);
}
}
fclose($file);
}
return $data;
}
}
Put that at the top of the script :)
egoldy
November 17th, 2004, 05:01 AM
if (!function_exists('file_get_contents'))
{
function file_get_contents($filename, $use_include_path = 0)
{
$file = @fopen($filename, 'rb', $use_include_path);
if ($file)
{
if ($fsize = @filesize($filename))
{
$data = fread($file, $fsize);
}
else
{
while (!feof($file))
{
$data .= fread($file, 1024);
}
}
fclose($file);
}
return $data;
}
}
Put that at the top of the script :)
Hi. njs12345
I am very happy for your back .and thanks very very much.
I have used you code top on my scripts. but it dosen't works fine.
when I useing it . the simple_save.php clear all contents in simple_editor.xml
now like this:
http://webstudio.com.cn/seditor/simple_editor.html
the simple_editor.xml cannot load.because contents have been cleared.
the simple_editor.xml only have two line:
<?xml version="1.0"?>
<edit>This is meant to be edited</edit>
I think the "file_get_contents()" should read the user input from keyboard.
if you have free time ,please download the source file and check it out.
http://www.kirupa.com/web/xml/examples/simple_editor.zip
Thanks a lot!
CyanBlue
November 17th, 2004, 07:00 AM
Can this be the file permission related issue???
What's the permission of the XML file???
egoldy
November 18th, 2004, 04:48 AM
Can this be the file permission related issue???
What's the permission of the XML file???
Hi. CyanBlue
Thanks for your back.
The simple_edit.xml have beed set CHMOD 777.It means you can write anything into it.
help! :*(
CyanBlue
November 18th, 2004, 01:22 PM
Uh... Where is your XML file??? Did you delete or something???
Wait a sec...
You are calling an XML file like this in Flash...
http://webstudio.com.cn/seditor/readwrite/simple_edit.xml
But you are calling an XML file like this in PHP...
http://webstudio.com.cn/seditor/simple_edit.xml
Different directory??? Maybe that's why it is not working???
egoldy
November 18th, 2004, 07:42 PM
hi.cyanblue
I have resend my xml files.
I thinks the simple_save.php doesn't works fine.
need using something to replace "file_get_contents("php://input"),because my php version is 4.23 and not 4.3.
CyanBlue
November 18th, 2004, 10:00 PM
Try this and tell me if it works... :)
<?php
$filename = "readwrite/simple_edit.xml";
//$raw_xml = file_get_contents("php://input");
//
//print $raw_xml;
$fp = fopen($filename, "w");
fwrite($fp, $raw_xml);
fclose($fp);
?>
egoldy
November 23rd, 2004, 04:35 AM
Try this and tell me if it works... :)
<?php
$filename = "readwrite/simple_edit.xml";
//$raw_xml = file_get_contents("php://input");
//
//print $raw_xml;
$fp = fopen($filename, "w");
fwrite($fp, $raw_xml);
fclose($fp);
?>
hi.
I have tested it .it doesn't work .
CyanBlue
November 23rd, 2004, 02:41 PM
Okay... Get rid of those // on the three lines and delete the simple_edit.xml file from the readwrite directory, and run the file again to see if it works... PHP script should generate the simple_edit.xml file again and start writing on that file...
Let me know... :)
egoldy
November 24th, 2004, 10:02 PM
Okay... Get rid of those // on the three lines and delete the simple_edit.xml file from the readwrite directory, and run the file again to see if it works... PHP script should generate the simple_edit.xml file again and start writing on that file...
Let me know... :)
Maybe you should check it out before.
http://www.kirupa.com/web/xml/examples/simpleeditor.htm
If I delete the simple_edit.xml from the readwrite dirctory.then what I will load into flash at first? and what I will edit ?
:hangover:
CyanBlue
November 30th, 2004, 01:28 AM
Yeah... I did check on the tutorial after I was messing with your file... and I did have the same problem as you did... and I was able to get rid of that problem by deleting the XML file that came in the package... Maybe you should just get this thing working first and then think about updating the data... Know what I mean??? Once the new file is created on the server with the valid permission, you should not have problem updating it... That's what I think... :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.