Ok, so I am following this tutorial, but modifying it slightly for use with another superior editor: XStandard. The problem is that when using the code supplied for the editor they are using (TinyMCE), it works fine, but modifying the code for XStandard makes the page blank when it loads, i even checked the source and it was blank. here is what the code supplied looks like for the edit page
and here is my modified version. BTW: it says how to use XStandard here
PHP:
<?php
include("../header.html");
// Get the page name from the query string
$page = $_GET['page'] . '.txt';
if (!$_GET['page']) {
echo("<h1>Page name not specified</h1>\n");
include("../footer.html");
exit;
}
if ($_POST['page']) {
$handle = fopen("../pages/$page", 'w');
fwrite($handle, $_POST['page']);
fclose($handle);
include("../pages/$page");
include("../footer.html");
exit;
}
if (file_exists("../pages/$page")) {
$FILE = fopen("../pages/$page", "rt");
while (!feof($FILE)) {
$text .= fgets($FILE);
}
fclose($FILE);
} else {
echo("<h1>New Page: $page</h1>\n");
$text = "<p></p>";
}
echo <<< EOM
<script language="javascript" type="text/javascript" src="/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom"
});
</script>
EOM;
$page = $_GET['page'] . '.txt';
$a = $_GET['page'];
$a = 1; //$_SERVER['PHP_SELF'];
$this_page = $_SERVER['PHP_SELF'];
$query_string = $_SERVER['QUERY_STRING'];
echo("<form method=\"post\" action=\"$this_page?$query_string\">\n");
echo("<textarea id=\"page\" name=\"page\" rows=25 cols=80>\n");
echo(htmlspecialchars($text));
echo("</textarea>\n");
echo("<input type=\"submit\" value=\"Save\">\n");
echo("</form>\n");
include("../footer.html");
?>
and here is my modified version. BTW: it says how to use XStandard here
PHP:
<?php
include("../header.html");
// Get the page name from the query string
$page = $_GET['page'] . '.txt';
if (!$_GET['page']) {
echo("<h1>Page name not specified</h1>\n");
include("../footer.html");
exit;
}
if ($_POST['page']) {
$handle = fopen("../pages/$page", 'w');
fwrite($handle, $_POST['page']);
fclose($handle);
include("../data/$page");
include("../footer.html");
exit;
}
if (file_exists("../data/$page")) {
$FILE = fopen("../data/$page", "rt");
while (!feof($FILE)) {
$text .= fgets($FILE);
}
fclose($FILE);
} else {
echo("<h1>New Page: $page</h1>\n");
$text = "<p></p>";
}
$page = $_GET['page'] . '.txt';
$a = $_GET['page'];
$a = 1; //$_SERVER['PHP_SELF'];
$this_page = $_SERVER['PHP_SELF'];
$query_string = $_SERVER['QUERY_STRING'];
echo("<form method=\"post\" action=\"$this_page?$query_string\">\n");
echo("<object name=\"page\" type=\"application/x-xstandard\" width=\"100%\" height=\"500\">\n");
echo("<param name=\"Value\" value=\"")
echo(htmlspecialchars($text));
echo("\" />");
echo("</object>\n");
echo("<input type=\"submit\" value=\"Save\" />\n");
echo("</form>\n");
include("../footer.html");
?>