xoops forums

xsell

Quite a regular
Posted on: 2010/2/9 8:47
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#1

Open text file , Write and Save

Hello

Is XOOPS uses any Class to Open a Text File in Dhtml TextArea
to edit and save..i have a text file in my root site i need to load it in textarea to edit the save..

I can do it in Pure php , fopen, fwrite.fclose.. But Just wondering if XOOPS uses other Methods..Load a text file to Textarea..

belia

Just popping in
Posted on: 2010/2/9 9:59
belia
belia (Show more)
Just popping in
Posts: 83
Since: 2007/12/18
#2

Re: Open text file , Write and Save



file editor is coming in XOOPS 2.5


yes i need this too...it will be cool if there is a temp solution with XOOPS 2.4.4


Quote:

I can do it in Pure php , fopen, fwrite.fclose.

can you share it ?

xsell

Quite a regular
Posted on: 2010/2/9 11:39
xsell
xsell (Show more)
Quite a regular
Posts: 245
Since: 2008/9/2 1
#3

Re: Open text file , Write and Save

try

$filename "somefile.txt";
$data $_POST['edit'];
if (
$data != '') {

$files fopen($filename'w') or die('Could not open file!');

$files_b fwrite($files,stripslashes($data)) or die('Could not write
to file'
);

fclose($files);
}

  
$files_h fopen($filename"r") or die("Could not open file!");

  
$data fread($files_hfilesize($filename)) or die("Could not read file!");

  
fclose($files_h);

 echo 
"<h3>edit</h3>

<form action='
$_SERVER[php_self]' method= 'post' >
<textarea name='edit' cols='60' rows='20'> 
$data </textarea><BR><BR>
<input type='submit' value='<<save>>'>
</form>"
;