I am using CKEditor with PHP.
Using the sample PHP where the $code variable gets echoed printing the code that triggers the CKEditor to show. I do the same only in a real layout and the what happens is the Editor engulfs the surroding HTML inside it as if it was the initialValue for it.
Any idea why I am getting this, please?
Here is the code:
// 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['t开发者_如何学GooolbarCanCollapse']=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);
Afterwards, I just do: $output.='<div>'.$CKEditorOutput.'</div>;
Of course, the layout around the div in which the CKEditor resides is larger.
Thank you!
Ah, got it...
This line: $CKEditorOutput = $CKEditor->editor("continut",$initialValue,$config);
The layout contains a div with an ID selector of "continut", so <div id="continut">.
Thus messing everything up and turning that div and all inner HTML into the RTE Textarea.
Sorry and thanks everyone!
精彩评论