与WYSIWYG编辑器有问题

时间:2012-06-10 20:46:33

标签: php html ckeditor

您好我在保存已编辑的页面时遇到问题。

WYSIWYG编辑器名为CkEditor。

这是我的管理员

<?php
session_start();
header("Cache-control: private");
require_once ('../include/back.php');
include_once("../ckeditor/ckeditor.php");?>
<html>
<head>
<title>ADMIN</title>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
</head>
<body>
<br>
<form action="../article.php" method="post" target="_blank">
<?php
$CKEditor->basePath = '/ckeditor/';
$CKEditor = new CKEditor();
$CKEditor->editor("editor1", $initialValue);
$initialValue = '<p>Words</p>';
?>
<input type="submit" value="Submit"/>
</form>
</body>
</html> 

以下是我的文章页面的第二页:

<?php
session_start();
header("Cache-control: private");
include("include/back.php");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
</head>
<body>
<div align="center">
<table>
<tr>
<td>
<?php
$editor_data = $_POST[ 'editor1' ];
echo $editor_data;
?>
</td>
</tr>
</table>
</body>
</html>

我无法从CKeditor保存我的文章页面文件(html)。当我输入内容并发布它时,CKeditor工作,但当我点击同一页面的菜单链接时,它是空白的。

任何建议或解释都将不胜感激。任何例子也会有所帮助。 Ť

1 个答案:

答案 0 :(得分:1)

您的文章页面是否仅使用以下代码来显示您输入到编辑器的内容?

<?php
    $editor_data = $_POST[ 'editor1' ];
    echo $editor_data;
?>
每个请求都会填充

$_POST变量。它并不意味着存储超过1个请求的数据。您必须获取此数据并将其保存为更持久的形式,如写入数据库或文件。使用此代码,您可以看到您输入到编辑器的内容,但仅在您发送时才能看到。生成页面并将其发送到浏览器后,文本将丢失。任何其他用户都不会仅仅因为他没有发送这些数据而看到这一点。当您返回页面时,您也不会看到它。

相关问题