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>Setting Configuration Options — 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 — Setting Configuration Options
\r
17 This sample shows how to insert a CKEditor instance with custom configuration options.
\r
20 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.
\r
22 <pre class="samples">
\r
24 // Include the CKEditor class.
\r
25 include_once "ckeditor/ckeditor.php";
\r
27 // Create a class instance.
\r
28 $CKEditor = new CKEditor();
\r
30 // Path to the CKEditor directory.
\r
31 $CKEditor->basePath = '/ckeditor/';
\r
33 // Set global configuration (used by every instance of CKEditor).
\r
34 $CKEditor-><strong>config['width']</strong> = 600;
\r
36 // Change default textarea attributes.
\r
37 $CKEditor-><strong>textareaAttributes</strong> = array("cols" => 80, "rows" => 10);
\r
39 // The initial value to be displayed in the editor.
\r
40 $initialValue = 'This is some sample text.';
\r
42 // Create the first instance.
\r
43 $CKEditor->editor("textarea_id", $initialValue);
\r
46 Note that <code><em>textarea_id</em></code> in the code above is the <code>name</code> attribute of
\r
47 the <code><textarea></code> element to be created.
\r
50 <!-- This <div> holds alert messages to be display in the sample page. -->
\r
54 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
\r
55 support, like yours, you should still see the contents (HTML data) and you should
\r
56 be able to edit it normally, without a rich editor interface.
\r
60 <form action="../sample_posteddata.php" method="post">
\r
61 <label>Editor 1:</label>
\r
63 // Include the CKEditor class.
\r
64 include("../../ckeditor.php");
\r
66 // Create a class instance.
\r
67 $CKEditor = new CKEditor();
\r
69 // Do not print the code directly to the browser, return it instead.
\r
70 $CKEditor->returnOutput = true;
\r
72 // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
\r
73 // $CKEditor->basePath = '/ckeditor/'
\r
74 // If not set, CKEditor will try to detect the correct path.
\r
75 $CKEditor->basePath = '../../';
\r
77 // Set global configuration (will be used by all instances of CKEditor).
\r
78 $CKEditor->config['width'] = 600;
\r
80 // Change default textarea attributes.
\r
81 $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);
\r
83 // The initial value to be displayed in the editor.
\r
84 $initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
\r
86 // Create the first instance.
\r
87 $code = $CKEditor->editor("editor1", $initialValue);
\r
92 <label>Editor 2:</label>
\r
94 // Configuration that will only be used by the second editor.
\r
95 $config['toolbar'] = array(
\r
96 array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
\r
97 array( 'Image', 'Link', 'Unlink', 'Anchor' )
\r
100 $config['skin'] = 'v2';
\r
102 // Create the second instance.
\r
103 echo $CKEditor->editor("editor2", $initialValue, $config);
\r
106 <input type="submit" value="Submit"/>
\r
112 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
\r
115 Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
\r
116 Knabben. All rights reserved.
\r