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>Replace All Textarea Elements — 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 — Replace All Textarea Elements Using PHP Code
|
danielebarchiesi@0
|
15 </h1>
|
danielebarchiesi@0
|
16 <div class="description">
|
danielebarchiesi@0
|
17 <p>
|
danielebarchiesi@0
|
18 This sample shows how to replace all <code><textarea></code> elements
|
danielebarchiesi@0
|
19 with CKEditor by using PHP code.
|
danielebarchiesi@0
|
20 </p>
|
danielebarchiesi@0
|
21 <p>
|
danielebarchiesi@0
|
22 To replace all <code><textarea></code> elements, place the following call at any point
|
danielebarchiesi@0
|
23 after the last <code><textarea></code> element:
|
danielebarchiesi@0
|
24 </p>
|
danielebarchiesi@0
|
25 <pre class="samples">
|
danielebarchiesi@0
|
26 <?php
|
danielebarchiesi@0
|
27 // Include the CKEditor class.
|
danielebarchiesi@0
|
28 include("ckeditor/ckeditor.php");
|
danielebarchiesi@0
|
29
|
danielebarchiesi@0
|
30 // Create a class instance.
|
danielebarchiesi@0
|
31 $CKEditor = new CKEditor();
|
danielebarchiesi@0
|
32
|
danielebarchiesi@0
|
33 // Path to the CKEditor directory.
|
danielebarchiesi@0
|
34 $CKEditor->basePath = '/ckeditor/';
|
danielebarchiesi@0
|
35
|
danielebarchiesi@0
|
36 // Replace all textarea elements with CKEditor.
|
danielebarchiesi@0
|
37 $CKEditor->replaceAll();
|
danielebarchiesi@0
|
38 ?></pre>
|
danielebarchiesi@0
|
39 </div>
|
danielebarchiesi@0
|
40 <!-- This <div> holds alert messages to be displayed in the sample page. -->
|
danielebarchiesi@0
|
41 <div id="alerts">
|
danielebarchiesi@0
|
42 <noscript>
|
danielebarchiesi@0
|
43 <p>
|
danielebarchiesi@0
|
44 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
|
danielebarchiesi@0
|
45 support, like yours, you should still see the contents (HTML data) and you should
|
danielebarchiesi@0
|
46 be able to edit it normally, without a rich editor interface.
|
danielebarchiesi@0
|
47 </p>
|
danielebarchiesi@0
|
48 </noscript>
|
danielebarchiesi@0
|
49 </div>
|
danielebarchiesi@0
|
50 <form action="../sample_posteddata.php" method="post">
|
danielebarchiesi@0
|
51 <p>
|
danielebarchiesi@0
|
52 <label for="editor1">
|
danielebarchiesi@0
|
53 Editor 1:</label>
|
danielebarchiesi@0
|
54 <textarea cols="80" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
danielebarchiesi@0
|
55 </p>
|
danielebarchiesi@0
|
56 <p>
|
danielebarchiesi@0
|
57 <label for="editor2">
|
danielebarchiesi@0
|
58 Editor 2:</label>
|
danielebarchiesi@0
|
59 <textarea cols="80" id="editor2" name="editor2" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
|
danielebarchiesi@0
|
60 </p>
|
danielebarchiesi@0
|
61 <p>
|
danielebarchiesi@0
|
62 <input type="submit" value="Submit"/>
|
danielebarchiesi@0
|
63 </p>
|
danielebarchiesi@0
|
64 </form>
|
danielebarchiesi@0
|
65 <div id="footer">
|
danielebarchiesi@0
|
66 <hr />
|
danielebarchiesi@0
|
67 <p>
|
danielebarchiesi@0
|
68 CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
|
danielebarchiesi@0
|
69 </p>
|
danielebarchiesi@0
|
70 <p id="copy">
|
danielebarchiesi@0
|
71 Copyright © 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
|
danielebarchiesi@0
|
72 Knabben. All rights reserved.
|
danielebarchiesi@0
|
73 </p>
|
danielebarchiesi@0
|
74 </div>
|
danielebarchiesi@0
|
75 <?php
|
danielebarchiesi@0
|
76 // Include the CKEditor class.
|
danielebarchiesi@0
|
77 include("../../ckeditor.php");
|
danielebarchiesi@0
|
78 // Create a class instance.
|
danielebarchiesi@0
|
79 $CKEditor = new CKEditor();
|
danielebarchiesi@0
|
80 // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
|
danielebarchiesi@0
|
81 // $CKEditor->basePath = '/ckeditor/'
|
danielebarchiesi@0
|
82 // If not set, CKEditor will try to detect the correct path.
|
danielebarchiesi@0
|
83 $CKEditor->basePath = '../../';
|
danielebarchiesi@0
|
84 // Replace all textarea elements with CKEditor.
|
danielebarchiesi@0
|
85 $CKEditor->replaceAll();
|
danielebarchiesi@0
|
86 ?>
|
danielebarchiesi@0
|
87 </body>
|
danielebarchiesi@0
|
88 </html>
|