danielebarchiesi@0
|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
danielebarchiesi@0
|
2 <!--
|
danielebarchiesi@0
|
3 Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
|
danielebarchiesi@0
|
4 For licensing, see LICENSE.html or http://ckeditor.com/license
|
danielebarchiesi@0
|
5 -->
|
danielebarchiesi@0
|
6 <html xmlns="http://www.w3.org/1999/xhtml">
|
danielebarchiesi@0
|
7 <head>
|
danielebarchiesi@0
|
8 <title>Setting Configuration Options — CKEditor Sample</title>
|
danielebarchiesi@0
|
9 <meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
danielebarchiesi@0
|
10 <link href="../sample.css" rel="stylesheet" type="text/css"/>
|
danielebarchiesi@0
|
11 </head>
|
danielebarchiesi@0
|
12 <body>
|
danielebarchiesi@0
|
13 <h1 class="samples">
|
danielebarchiesi@0
|
14 CKEditor Sample — Setting Configuration Options
|
danielebarchiesi@0
|
15 </h1>
|
danielebarchiesi@0
|
16 <p>
|
danielebarchiesi@0
|
17 This sample shows how to insert a CKEditor instance with custom configuration options.
|
danielebarchiesi@0
|
18 </p>
|
danielebarchiesi@0
|
19 <p>
|
danielebarchiesi@0
|
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.
|
danielebarchiesi@0
|
21 </p>
|
danielebarchiesi@0
|
22 <pre class="samples">
|
danielebarchiesi@0
|
23 <?php
|
danielebarchiesi@0
|
24 // Include the CKEditor class.
|
danielebarchiesi@0
|
25 include_once "ckeditor/ckeditor.php";
|
danielebarchiesi@0
|
26
|
danielebarchiesi@0
|
27 // Create a class instance.
|
danielebarchiesi@0
|
28 $CKEditor = new CKEditor();
|
danielebarchiesi@0
|
29
|
danielebarchiesi@0
|
30 // Path to the CKEditor directory.
|
danielebarchiesi@0
|
31 $CKEditor->basePath = '/ckeditor/';
|
danielebarchiesi@0
|
32
|
danielebarchiesi@0
|
33 // Set global configuration (used by every instance of CKEditor).
|
danielebarchiesi@0
|
34 $CKEditor-><strong>config['width']</strong> = 600;
|
danielebarchiesi@0
|
35
|
danielebarchiesi@0
|
36 // Change default textarea attributes.
|
danielebarchiesi@0
|
37 $CKEditor-><strong>textareaAttributes</strong> = array("cols" => 80, "rows" => 10);
|
danielebarchiesi@0
|
38
|
danielebarchiesi@0
|
39 // The initial value to be displayed in the editor.
|
danielebarchiesi@0
|
40 $initialValue = 'This is some sample text.';
|
danielebarchiesi@0
|
41
|
danielebarchiesi@0
|
42 // Create the first instance.
|
danielebarchiesi@0
|
43 $CKEditor->editor("textarea_id", $initialValue);
|
danielebarchiesi@0
|
44 ?></pre>
|
danielebarchiesi@0
|
45 <p>
|
danielebarchiesi@0
|
46 Note that <code><em>textarea_id</em></code> in the code above is the <code>name</code> attribute of
|
danielebarchiesi@0
|
47 the <code><textarea></code> element to be created.
|
danielebarchiesi@0
|
48 </p>
|
danielebarchiesi@0
|
49
|
danielebarchiesi@0
|
50 <!-- This <div> holds alert messages to be display in the sample page. -->
|
danielebarchiesi@0
|
51 <div id="alerts">
|
danielebarchiesi@0
|
52 <noscript>
|
danielebarchiesi@0
|
53 <p>
|
danielebarchiesi@0
|
54 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
danielebarchiesi@0
|
55 support, like yours, you should still see the contents (HTML data) and you should
|
danielebarchiesi@0
|
56 be able to edit it normally, without a rich editor interface.
|
danielebarchiesi@0
|
57 </p>
|
danielebarchiesi@0
|
58 </noscript>
|
danielebarchiesi@0
|
59 </div>
|
danielebarchiesi@0
|
60 <form action="../sample_posteddata.php" method="post">
|
danielebarchiesi@0
|
61 <label>Editor 1:</label>
|
danielebarchiesi@0
|
62 <?php
|
danielebarchiesi@0
|
63 // Include the CKEditor class.
|
danielebarchiesi@0
|
64 include("../../ckeditor.php");
|
danielebarchiesi@0
|
65
|
danielebarchiesi@0
|
66 // Create a class instance.
|
danielebarchiesi@0
|
67 $CKEditor = new CKEditor();
|
danielebarchiesi@0
|
68
|
danielebarchiesi@0
|
69 // Do not print the code directly to the browser, return it instead.
|
danielebarchiesi@0
|
70 $CKEditor->returnOutput = true;
|
danielebarchiesi@0
|
71
|
danielebarchiesi@0
|
72 // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
danielebarchiesi@0
|
73 // $CKEditor->basePath = '/ckeditor/'
|
danielebarchiesi@0
|
74 // If not set, CKEditor will try to detect the correct path.
|
danielebarchiesi@0
|
75 $CKEditor->basePath = '../../';
|
danielebarchiesi@0
|
76
|
danielebarchiesi@0
|
77 // Set global configuration (will be used by all instances of CKEditor).
|
danielebarchiesi@0
|
78 $CKEditor->config['width'] = 600;
|
danielebarchiesi@0
|
79
|
danielebarchiesi@0
|
80 // Change default textarea attributes.
|
danielebarchiesi@0
|
81 $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);
|
danielebarchiesi@0
|
82
|
danielebarchiesi@0
|
83 // The initial value to be displayed in the editor.
|
danielebarchiesi@0
|
84 $initialValue = '<p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p>';
|
danielebarchiesi@0
|
85
|
danielebarchiesi@0
|
86 // Create the first instance.
|
danielebarchiesi@0
|
87 $code = $CKEditor->editor("editor1", $initialValue);
|
danielebarchiesi@0
|
88
|
danielebarchiesi@0
|
89 echo $code;
|
danielebarchiesi@0
|
90 ?>
|
danielebarchiesi@0
|
91 <br />
|
danielebarchiesi@0
|
92 <label>Editor 2:</label>
|
danielebarchiesi@0
|
93 <?php
|
danielebarchiesi@0
|
94 // Configuration that will only be used by the second editor.
|
danielebarchiesi@0
|
95 $config['toolbar'] = array(
|
danielebarchiesi@0
|
96 array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
|
danielebarchiesi@0
|
97 array( 'Image', 'Link', 'Unlink', 'Anchor' )
|
danielebarchiesi@0
|
98 );
|
danielebarchiesi@0
|
99
|
danielebarchiesi@0
|
100 $config['skin'] = 'v2';
|
danielebarchiesi@0
|
101
|
danielebarchiesi@0
|
102 // Create the second instance.
|
danielebarchiesi@0
|
103 echo $CKEditor->editor("editor2", $initialValue, $config);
|
danielebarchiesi@0
|
104 ?>
|
danielebarchiesi@0
|
105 <p>
|
danielebarchiesi@0
|
106 <input type="submit" value="Submit"/>
|
danielebarchiesi@0
|
107 </p>
|
danielebarchiesi@0
|
108 </form>
|
danielebarchiesi@0
|
109 <div id="footer">
|
danielebarchiesi@0
|
110 <hr />
|
danielebarchiesi@0
|
111 <p>
|
danielebarchiesi@0
|
112 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
danielebarchiesi@0
|
113 </p>
|
danielebarchiesi@0
|
114 <p id="copy">
|
danielebarchiesi@0
|
115 Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
danielebarchiesi@0
|
116 Knabben. All rights reserved.
|
danielebarchiesi@0
|
117 </p>
|
danielebarchiesi@0
|
118 </div>
|
danielebarchiesi@0
|
119 </body>
|
danielebarchiesi@0
|
120 </html>
|