1
xsell
Open text file , Write and Save
  • 2010/2/9 8:47

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


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..

2
belia
Re: Open text file , Write and Save
  • 2010/2/9 9:59

  • belia

  • Just popping in

  • Posts: 83

  • Since: 2007/12/18




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 ?

3
xsell
Re: Open text file , Write and Save
  • 2010/2/9 11:39

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


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>"
;

Login

Who's Online

205 user(s) are online (140 user(s) are browsing Support Forums)


Members: 0


Guests: 205


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits