1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
\r
3 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
6 <html xmlns="http://www.w3.org/1999/xhtml">
\r
8 <title>Creating CKEditor Instances — CKEditor Sample</title>
\r
9 <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
\r
10 <link href="../sample.css" rel="stylesheet" type="text/css"/>
\r
13 <h1 class="samples">
\r
14 CKEditor Sample — Creating CKEditor Instances
\r
16 <div class="description">
\r
18 This sample shows how to create a CKEditor instance with PHP.
\r
20 <pre class="samples">
\r
22 include_once "ckeditor/ckeditor.php";
\r
24 // Create a class instance.
\r
25 $CKEditor = new CKEditor();
\r
27 // Path to the CKEditor directory.
\r
28 $CKEditor->basePath = '/ckeditor/';
\r
30 // Create a textarea element and attach CKEditor to it.
\r
31 $CKEditor->editor("textarea_id", "This is some sample text");
\r
34 Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of
\r
35 the <code><textarea></code> element that will be created.
\r
38 <!-- This <div> holds alert messages to be display in the sample page. -->
\r
42 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
\r
43 support, like yours, you should still see the contents (HTML data) and you should
\r
44 be able to edit it normally, without a rich editor interface.
\r
48 <!-- This <fieldset> holds the HTML code that you will usually find in your pages. -->
\r
49 <form action="../sample_posteddata.php" method="post">
\r
51 <label for="editor1">
\r
56 // Include the CKEditor class.
\r
57 include_once "../../ckeditor.php";
\r
58 // The initial value to be displayed in the editor.
\r
59 $initialValue = '<p>This is some <strong>sample text</strong>.</p>';
\r
60 // Create a class instance.
\r
61 $CKEditor = new CKEditor();
\r
62 // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
\r
63 // $CKEditor->basePath = '/ckeditor/'
\r
64 // If not set, CKEditor will try to detect the correct path.
\r
65 $CKEditor->basePath = '../../';
\r
66 // Create a textarea element and attach CKEditor to it.
\r
67 $CKEditor->editor("editor1", $initialValue);
\r
69 <input type="submit" value="Submit"/>
\r
75 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
78 Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
79 Knabben. All rights reserved.
\r