I want to use fckeditor for online editing of existing html
and php source files (behind a password barrier).
I hacked a script that does the following:
$filecontents = @file_get_contents($_GET['file']);
$oFCKeditor->Value = $filecontents;
$oFCKeditor->Create() ;
then I use javascript to flip the editor into source mode:
<script type="text/javascript"><!--
function FCKeditor_OnComplete(editorInstance) {
editorInstance.SwitchEditMode();
}
--></script>
...but this does not work as hoped.
fck seems to be stripping of the html and body tags, and
a spurious <p> </p> surrounds the contents I sucked in.
Is it possible to use fck for editing text (including php source)
or should I look for another editor?
and php source files (behind a password barrier).
I hacked a script that does the following:
$filecontents = @file_get_contents($_GET['file']);
$oFCKeditor->Value = $filecontents;
$oFCKeditor->Create() ;
then I use javascript to flip the editor into source mode:
<script type="text/javascript"><!--
function FCKeditor_OnComplete(editorInstance) {
editorInstance.SwitchEditMode();
}
--></script>
...but this does not work as hoped.
fck seems to be stripping of the html and body tags, and
a spurious <p> </p> surrounds the contents I sucked in.
Is it possible to use fck for editing text (including php source)
or should I look for another editor?
Re: fckeditor as an online text editor
Re: fckeditor as an online text editor
....I fought with that for an hour or two and then decided to wait for fckeditor_3.0
which promises a text editing mode.
In the meantime the following works suprisingly well:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$disp = stripslashes(trim($_POST['stuff']));
$disp = preg_replace("/\n/","1234xxxyyybushzzzaaaobama", $disp);
$disp = htmlentities($disp);
$disp = preg_replace("/1234xxxyyybushzzzaaaobama/", "<br>", $disp);
echo $disp,'<br>';
$outfile = "demobuffer";
$fp = fopen($outfile,"w");
if($fp == null)
{
echo sprintf("couldn't open %s for some reason.<br>", $outfile );
}
else
{
fwrite($fp, stripslashes(preg_replace("/\r/","", $_POST['stuff'])));
fclose($fp);
}
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<textarea name="stuff" cols="120" rows="20"> '.stripslashes(trim($_POST['stuff'])).' </textarea><br>
<input type="submit">
</form>';
?>