Hi pty.
I've also tried out having a main page with a submit button that then sends the file name (as a hidden field) to the page with the editor and then putting it into a variable, but no result.
I'm using the JavaScript version of the editor and working in PHP. Should I be using the PHP version of the editor?
The pages and code is as follows:
Admin page (admin/index.php page)
in head:
<script type="text/javascript" src="/FCKeditor/fckeditor.js"></script>
in body:
<div id="content">
<form method="post" action="savefile.php">
<script type="text/javascript">
var oFCKeditor = new FCKeditor('FCKeditor1');
oFCKeditor.BasePath = "/FCKeditor/";
oFCKeditor.Value = "[COLOR=darkorange]<?php include('../test/test.html') ?>";
oFCKeditor.Create();
</script>
<input type="submit" value="Submit!" />
</form>
</div><!-- end content --> Save File page (admin/savefile.php page)
<?php
$newContent = stripslashes($_POST['FCKeditor1']);
$fileLocation = "../test/test.html";
$fh = fopen($fileLocation, 'w') or die("Sorry, can't open file...");
$stringData = $newContent;
fwrite($fh, $stringData);
fclose($fh);
?> Viewed page (test/index.php)
<div id="content"><?php include('test.html'); ?></div><!-- end content --> Content file (test/test.html)
<h1>Welcome!</h1>
<p> Lorem ipsum dolor sit…</p>