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