first import
This commit is contained in:
120
sites/all/libraries/ckeditor/_samples/php/advanced.php
Normal file
120
sites/all/libraries/ckeditor/_samples/php/advanced.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Setting Configuration Options — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Setting Configuration Options
|
||||
</h1>
|
||||
<p>
|
||||
This sample shows how to insert a CKEditor instance with custom configuration options.
|
||||
</p>
|
||||
<p>
|
||||
To set configuration options, use the <a class="samples" href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html"><code>config</code></a> property. To set the attributes of a <code><textarea></code> element (which is displayed instead of CKEditor in unsupported browsers), use the <code>textareaAttributes</code> property.
|
||||
</p>
|
||||
<pre class="samples">
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include_once "ckeditor/ckeditor.php";
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Path to the CKEditor directory.
|
||||
$CKEditor->basePath = '/ckeditor/';
|
||||
|
||||
// Set global configuration (used by every instance of CKEditor).
|
||||
$CKEditor-><strong>config['width']</strong> = 600;
|
||||
|
||||
// Change default textarea attributes.
|
||||
$CKEditor-><strong>textareaAttributes</strong> = array("cols" => 80, "rows" => 10);
|
||||
|
||||
// The initial value to be displayed in the editor.
|
||||
$initialValue = 'This is some sample text.';
|
||||
|
||||
// Create the first instance.
|
||||
$CKEditor->editor("textarea_id", $initialValue);
|
||||
?></pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>name</code> attribute of
|
||||
the <code><textarea></code> element to be created.
|
||||
</p>
|
||||
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="../sample_posteddata.php" method="post">
|
||||
<label>Editor 1:</label>
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include("../../ckeditor.php");
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Do not print the code directly to the browser, return it instead.
|
||||
$CKEditor->returnOutput = true;
|
||||
|
||||
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
||||
// $CKEditor->basePath = '/ckeditor/'
|
||||
// If not set, CKEditor will try to detect the correct path.
|
||||
$CKEditor->basePath = '../../';
|
||||
|
||||
// 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);
|
||||
|
||||
// The initial value to be displayed in the editor.
|
||||
$initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
|
||||
|
||||
// Create the first instance.
|
||||
$code = $CKEditor->editor("editor1", $initialValue);
|
||||
|
||||
echo $code;
|
||||
?>
|
||||
<br />
|
||||
<label>Editor 2:</label>
|
||||
<?php
|
||||
// Configuration that will only be used by the second editor.
|
||||
$config['toolbar'] = array(
|
||||
array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
|
||||
array( 'Image', 'Link', 'Unlink', 'Anchor' )
|
||||
);
|
||||
|
||||
$config['skin'] = 'v2';
|
||||
|
||||
// Create the second instance.
|
||||
echo $CKEditor->editor("editor2", $initialValue, $config);
|
||||
?>
|
||||
<p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
153
sites/all/libraries/ckeditor/_samples/php/events.php
Normal file
153
sites/all/libraries/ckeditor/_samples/php/events.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Adding Event Handlers — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Adding Event Handlers
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to add event handlers to CKEditor with PHP.
|
||||
</p>
|
||||
<p>
|
||||
A snippet of the configuration code can be seen below; check the source code of this page for
|
||||
the full definition:
|
||||
</p>
|
||||
<pre class="samples"><?php
|
||||
// Include the CKEditor class.
|
||||
include("ckeditor/ckeditor.php");
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Path to the CKEditor directory.
|
||||
$CKEditor->basePath = '/ckeditor/';
|
||||
|
||||
// The initial value to be displayed in the editor.
|
||||
$initialValue = 'This is some sample text.';
|
||||
|
||||
// Add event handler, <em>instanceReady</em> is fired when editor is loaded.
|
||||
$CKEditor-><strong>addEventHandler</strong>('instanceReady', 'function (evt) {
|
||||
alert("Loaded editor: " + evt.editor.name);
|
||||
}');
|
||||
|
||||
// Create an editor instance.
|
||||
$CKEditor->editor("editor1", $initialValue);
|
||||
</pre>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="../sample_posteddata.php" method="post">
|
||||
<label>Editor 1:</label>
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Adds a global event, will hide the "Target" tab in the "Link" dialog window in all instances.
|
||||
*/
|
||||
function CKEditorHideLinkTargetTab(&$CKEditor) {
|
||||
|
||||
$function = 'function (ev) {
|
||||
// Take the dialog window name and its definition from the event data.
|
||||
var dialogName = ev.data.name;
|
||||
var dialogDefinition = ev.data.definition;
|
||||
|
||||
// Check if the definition comes from the "Link" dialog window.
|
||||
if ( dialogName == "link" )
|
||||
dialogDefinition.removeContents("target")
|
||||
}';
|
||||
|
||||
$CKEditor->addGlobalEventHandler('dialogDefinition', $function);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a global event, will notify about an open dialog window.
|
||||
*/
|
||||
function CKEditorNotifyAboutOpenedDialog(&$CKEditor) {
|
||||
$function = 'function (evt) {
|
||||
alert("Loading a dialog window: " + evt.data.name);
|
||||
}';
|
||||
|
||||
$CKEditor->addGlobalEventHandler('dialogDefinition', $function);
|
||||
}
|
||||
|
||||
// Include the CKEditor class.
|
||||
include("../../ckeditor.php");
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Set a configuration option for all editors.
|
||||
$CKEditor->config['width'] = 750;
|
||||
|
||||
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
||||
// $CKEditor->basePath = '/ckeditor/'
|
||||
// If not set, CKEditor will try to detect the correct path.
|
||||
$CKEditor->basePath = '../../';
|
||||
|
||||
// The initial value to be displayed in the editor.
|
||||
$initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
|
||||
|
||||
// Event that will be handled only by the first editor.
|
||||
$CKEditor->addEventHandler('instanceReady', 'function (evt) {
|
||||
alert("Loaded editor: " + evt.editor.name);
|
||||
}');
|
||||
|
||||
// Create the first instance.
|
||||
$CKEditor->editor("editor1", $initialValue);
|
||||
|
||||
// Clear event handlers. Instances that will be created later will not have
|
||||
// the 'instanceReady' listener defined a couple of lines above.
|
||||
$CKEditor->clearEventHandlers();
|
||||
?>
|
||||
<br />
|
||||
<label>Editor 2:</label>
|
||||
<?php
|
||||
// Configuration that will only be used by the second editor.
|
||||
$config['width'] = '600';
|
||||
$config['toolbar'] = 'Basic';
|
||||
|
||||
// Add some global event handlers (for all editors).
|
||||
CKEditorHideLinkTargetTab($CKEditor);
|
||||
CKEditorNotifyAboutOpenedDialog($CKEditor);
|
||||
|
||||
// Event that will only be handled by the second editor.
|
||||
// Instead of calling addEventHandler(), events may be passed as an argument.
|
||||
$events['instanceReady'] = 'function (evt) {
|
||||
alert("Loaded second editor: " + evt.editor.name);
|
||||
}';
|
||||
|
||||
// Create the second instance.
|
||||
$CKEditor->editor("editor2", $initialValue, $config, $events);
|
||||
?>
|
||||
<p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
47
sites/all/libraries/ckeditor/_samples/php/index.html
Normal file
47
sites/all/libraries/ckeditor/_samples/php/index.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||
<title>CKEditor Samples — PHP Integration</title>
|
||||
<link type="text/css" rel="stylesheet" href="../sample.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Samples List for PHP
|
||||
</h1>
|
||||
<h2 class="samples">
|
||||
Basic Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="replace.php">Replace existing textarea elements by code</a><br />
|
||||
Replacement of selected textarea elements with CKEditor instances by using a JavaScript call.</li>
|
||||
<li><a class="samples" href="replaceall.php">Replace all textarea elements by code</a><br />
|
||||
Replacement of all textarea elements with CKEditor instances by using a JavaScript call.</li>
|
||||
<li><a class="samples" href="standalone.php">Create CKEditor instances in PHP</a><br />
|
||||
Creating a CKEditor instance (no initial textarea element is required).</li>
|
||||
</ul>
|
||||
<h2 class="samples">
|
||||
Advanced Samples
|
||||
</h2>
|
||||
<ul class="samples">
|
||||
<li><a class="samples" href="advanced.php">Setting configuration options</a><br />
|
||||
Creating a CKEditor instance with custom configuration options.</li>
|
||||
<li><a class="samples" href="events.php">Listening to events</a><br />
|
||||
Creating event handlers.
|
||||
</li>
|
||||
</ul>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
87
sites/all/libraries/ckeditor/_samples/php/replace.php
Normal file
87
sites/all/libraries/ckeditor/_samples/php/replace.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace Selected Textarea Elements — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Replace Selected Textarea Elements Using PHP Code
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to replace a selected <code><textarea></code> element
|
||||
with a CKEditor instance by using PHP code.
|
||||
</p>
|
||||
<p>
|
||||
To replace a <code><textarea></code> element, place the following call at any point
|
||||
after the <code><textarea></code> element:
|
||||
</p>
|
||||
<pre class="samples">
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include_once "ckeditor/ckeditor.php";
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Path to the CKEditor directory.
|
||||
$CKEditor->basePath = '/ckeditor/';
|
||||
|
||||
// Replace a textarea element with an id (or name) of "textarea_id".
|
||||
$CKEditor->replace("textarea_id");
|
||||
?></pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> attribute of
|
||||
the <code><textarea></code> element to be replaced.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="../sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include_once "../../ckeditor.php";
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
||||
// $CKEditor->basePath = '/ckeditor/'
|
||||
// If not set, CKEditor will try to detect the correct path.
|
||||
$CKEditor->basePath = '../../';
|
||||
// Replace a textarea element with an id (or name) of "editor1".
|
||||
$CKEditor->replace("editor1");
|
||||
?>
|
||||
</body>
|
||||
</html>
|
88
sites/all/libraries/ckeditor/_samples/php/replaceall.php
Normal file
88
sites/all/libraries/ckeditor/_samples/php/replaceall.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Replace All Textarea Elements — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Replace All Textarea Elements Using PHP Code
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to replace all <code><textarea></code> elements
|
||||
with CKEditor by using PHP code.
|
||||
</p>
|
||||
<p>
|
||||
To replace all <code><textarea></code> elements, place the following call at any point
|
||||
after the last <code><textarea></code> element:
|
||||
</p>
|
||||
<pre class="samples">
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include("ckeditor/ckeditor.php");
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Path to the CKEditor directory.
|
||||
$CKEditor->basePath = '/ckeditor/';
|
||||
|
||||
// Replace all textarea elements with CKEditor.
|
||||
$CKEditor->replaceAll();
|
||||
?></pre>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be displayed in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<form action="../sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
<textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="editor2">
|
||||
Editor 2:</label>
|
||||
<textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include("../../ckeditor.php");
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
||||
// $CKEditor->basePath = '/ckeditor/'
|
||||
// If not set, CKEditor will try to detect the correct path.
|
||||
$CKEditor->basePath = '../../';
|
||||
// Replace all textarea elements with CKEditor.
|
||||
$CKEditor->replaceAll();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
83
sites/all/libraries/ckeditor/_samples/php/standalone.php
Normal file
83
sites/all/libraries/ckeditor/_samples/php/standalone.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!--
|
||||
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.html or http://ckeditor.com/license
|
||||
-->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Creating CKEditor Instances — CKEditor Sample</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<link href="../sample.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="samples">
|
||||
CKEditor Sample — Creating CKEditor Instances
|
||||
</h1>
|
||||
<div class="description">
|
||||
<p>
|
||||
This sample shows how to create a CKEditor instance with PHP.
|
||||
</p>
|
||||
<pre class="samples">
|
||||
<?php
|
||||
include_once "ckeditor/ckeditor.php";
|
||||
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
|
||||
// Path to the CKEditor directory.
|
||||
$CKEditor->basePath = '/ckeditor/';
|
||||
|
||||
// Create a textarea element and attach CKEditor to it.
|
||||
$CKEditor->editor("textarea_id", "This is some sample text");
|
||||
?></pre>
|
||||
<p>
|
||||
Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of
|
||||
the <code><textarea></code> element that will be created.
|
||||
</p>
|
||||
</div>
|
||||
<!-- This <div> holds alert messages to be display in the sample page. -->
|
||||
<div id="alerts">
|
||||
<noscript>
|
||||
<p>
|
||||
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
||||
support, like yours, you should still see the contents (HTML data) and you should
|
||||
be able to edit it normally, without a rich editor interface.
|
||||
</p>
|
||||
</noscript>
|
||||
</div>
|
||||
<!-- This <fieldset> holds the HTML code that you will usually find in your pages. -->
|
||||
<form action="../sample_posteddata.php" method="post">
|
||||
<p>
|
||||
<label for="editor1">
|
||||
Editor 1:</label>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
// Include the CKEditor class.
|
||||
include_once "../../ckeditor.php";
|
||||
// The initial value to be displayed in the editor.
|
||||
$initialValue = '<p>This is some <strong>sample text</strong>.</p>';
|
||||
// Create a class instance.
|
||||
$CKEditor = new CKEditor();
|
||||
// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
||||
// $CKEditor->basePath = '/ckeditor/'
|
||||
// If not set, CKEditor will try to detect the correct path.
|
||||
$CKEditor->basePath = '../../';
|
||||
// Create a textarea element and attach CKEditor to it.
|
||||
$CKEditor->editor("editor1", $initialValue);
|
||||
?>
|
||||
<input type="submit" value="Submit"/>
|
||||
</p>
|
||||
</form>
|
||||
<div id="footer">
|
||||
<hr />
|
||||
<p>
|
||||
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
||||
</p>
|
||||
<p id="copy">
|
||||
Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
||||
Knabben. All rights reserved.
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user