在ckeditor中编辑内容

发布于 2024-10-14 11:59:55 字数 962 浏览 0 评论 0原文

我在我的网站中使用 ckeditor 将内容添加到页面。 但我无法理解如何在 ckeditor 中获取此内容以便稍后编辑...

如何将内容加载到 ckeditor 中?我使用以下代码来加载编辑器:

    if ( !@file_exists( '../../ckeditor/ckeditor.php' ) )
    {
    if ( @file_exists('../../ckeditor/ckeditor.js') || @file_exists('../../../ckeditor/ckeditor_source.js') )
        printNotFound('CKEditor 3.1+');
    else
        printNotFound('CKEditor');
    }


include_once '../../ckeditor/ckeditor.php';
include_once '../../ckfinder/ckfinder.php';

// This is a check for the CKEditor class. If not defined, the paths in lines 57 and 70 must be checked.
if (!class_exists('CKEditor'))
{
    printNotFound('CKEditor');
}
else
{
 $ckeditor = new CKEditor();
 $ckeditor->basePath = '../../ckeditor/';
 $ckfinder = new CKFinder();
 $ckfinder->BasePath = '../../ckfinder/'; // Note: BasePath property in CKFinder class starts with capital letter
 $ckfinder->SetupCKEditorObject($ckeditor);
 $ckeditor->editor('message');
}

iam using ckeditor in my website to add the content to the pages.
But I'm not able to understand how I get this content in ckeditor for editing it later...

How to load content into the ckeditor? Iam using the following code to load the editor:

    if ( !@file_exists( '../../ckeditor/ckeditor.php' ) )
    {
    if ( @file_exists('../../ckeditor/ckeditor.js') || @file_exists('../../../ckeditor/ckeditor_source.js') )
        printNotFound('CKEditor 3.1+');
    else
        printNotFound('CKEditor');
    }


include_once '../../ckeditor/ckeditor.php';
include_once '../../ckfinder/ckfinder.php';

// This is a check for the CKEditor class. If not defined, the paths in lines 57 and 70 must be checked.
if (!class_exists('CKEditor'))
{
    printNotFound('CKEditor');
}
else
{
 $ckeditor = new CKEditor();
 $ckeditor->basePath = '../../ckeditor/';
 $ckfinder = new CKFinder();
 $ckfinder->BasePath = '../../ckfinder/'; // Note: BasePath property in CKFinder class starts with capital letter
 $ckfinder->SetupCKEditorObject($ckeditor);
 $ckeditor->editor('message');
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮凉 2024-10-21 11:59:55

一种方法是使用适当的(htmlentities() 已处理的)HTML 内容预填充

请参阅开发人员指南中的集成章节

One way is to pre-populate the <textarea> field with the appropriate (htmlentities() processed) HTML content. CKEditor will automatically fetch the data, and insert it into the WYSIWYG editor.

See the Integration chapter in the developers guide

帅气称霸 2024-10-21 11:59:55

对于那些没有找到答案的人,ckeditor 的“编辑器”方法允许加载默认值,

public function editor($name, $value = "", $config = array(), $events = array())

只需在第二个参数中传递默认值即可。

For those who not found the answer, the "editor" method of ckeditor allow to load default value

public function editor($name, $value = "", $config = array(), $events = array())

Just pass your default value in the second parameters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文