首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CKEditor PHP集成

CKEditor PHP集成
EN

Stack Overflow用户
提问于 2010-08-31 01:42:11
回答 1查看 27.2K关注 0票数 2

我使用的是CKEditor和PHP。

使用样例PHP,在其中回显$code变量,打印触发CKEditor显示的代码。我只在一个真实的布局中做同样的事情,发生的是编辑器吞没了里面的超文本标记语言,就好像它是它的initialValue一样。

你知道为什么我会得到这个吗?

代码如下:

代码语言:javascript
复制
// Include CKEditor class.
@require_once("ckeditor/ckeditor.php");

// Create class instance.
$CKEditor = new CKEditor();

// Do not print the code directly to the browser, return it instead
$CKEditor->returnOutput = true;

// Path to CKEditor directory, ideally instead of relative dir, use an absolute path:
//   $CKEditor->basePath = '/ckeditor/'
// If not set, CKEditor will try to detect the correct path.
$CKEditor->basePath = 'ckeditor/';

// Set global configuration (will be used by all instances of CKEditor).
$CKEditor->config['width'] = 600;

// Change default textarea attributes
//$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);

//Set formatting options
$config['toolbar'] = array(
    array( 'Source','-',
          'NewPage','Preview','Templates','-',
          'Cut','Copy','Paste','PasteText','PasteFromWord','-',
          'Undo','Redo','-',
          'Find','Replace','-',
          'SelectAll','RemoveFormat','-',
          'Maximize', 'ShowBlocks'),
    '/',
    array('Bold','Italic','Underline','Strike','-',
          'Subscript','Superscript','-',
          'NumberedList','BulletedList','-',
          'Outdent','Indent','Blockquote','-',
          'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-',
          'Link','Unlink','Anchor','-',
          'Image','Flash','Table','HorizontalRule','SpecialChar'
          ),
    '/',
    array('Format','Font','FontSize','-',
          'TextColor','BGColor')
);

//Set skin
//$config['skin'] = 'kama';//kama si defailt skin for 3.4

//Set language and UI Color
$config['language']='ro';
//$config['uiColor']='#AADC6E';


//Remove the html tags in the status bar (e.g. body p strong for when cursor is in a strong tag within a p tag within the body)
$config['removePlugins']='elementspath';

//Allow / deny resizing of editor from dragging the bottom-right corner. Maximize will still work.
$config['removePlugins']='resize';//Remove resize image
$config['resize_enabled ']=false;//Disallow resizing

//Remove the collapse formatting area button (arrow on the middle-right part of the editor
//$config['toolbarCanCollapse']=false;

// The initial value to be displayed in the editor.
$initialValue = '';

//Add the CKFinder for upload of files directly from the `Add Image` / `Add Flash` buttons.
include_once($CKEditor->basePath.'ckfinder/ckfinder.php');
// You can use the "CKFinder" class to render CKFinder in a page:
$finder = new CKFinder();
$finder->BasePath = 'ckeditor/ckfinder/';   // The path for the installation of CKFinder (default = "/ckfinder/").
//$finder->SetupCKEditor($CKEditor,$CKEditor->basePath.'/ckfinder/');

// Create first instance.
$CKEditorOutput = $CKEditor->editor("continut",$initialValue,$config);

然后,我就这样做了:当然,CKEditor所在的$output.='<div>'.$CKEditorOutput.'</div>;周围的布局更大。

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-08-31 18:09:49

啊,明白了..。

这一行:$CKEditorOutput = $CKEditor->editor("continut",$initialValue,$config);

布局包含一个带有ID选择器"continut“的div,因此<div id="continut">.把所有东西都搞乱了,把那个div和所有内部HTML都变成了RTE Textarea。

对不起,谢谢大家!

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3602837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档