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