JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _samples / php / standalone.php
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
2 <!--\r
3 Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
4 For licensing, see LICENSE.html or http://ckeditor.com/license\r
5 -->\r
6 <html xmlns="http://www.w3.org/1999/xhtml">\r
7 <head>\r
8         <title>Creating CKEditor Instances &mdash; 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
11 </head>\r
12 <body>\r
13         <h1 class="samples">\r
14                 CKEditor Sample &mdash; Creating CKEditor Instances\r
15         </h1>\r
16         <div class="description">\r
17         <p>\r
18                 This sample shows how to create a CKEditor instance with PHP.\r
19         </p>\r
20         <pre class="samples">\r
21 &lt;?php\r
22 include_once "ckeditor/ckeditor.php";\r
23 \r
24 // Create a class instance.\r
25 $CKEditor = new CKEditor();\r
26 \r
27 // Path to the CKEditor directory.\r
28 $CKEditor->basePath = '/ckeditor/';\r
29 \r
30 // Create a textarea element and attach CKEditor to it.\r
31 $CKEditor->editor("textarea_id", "This is some sample text");\r
32 ?&gt;</pre>\r
33         <p>\r
34                 Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of\r
35                 the <code>&lt;textarea&gt;</code> element that will be created.\r
36         </p>\r
37         </div>\r
38         <!-- This <div> holds alert messages to be display in the sample page. -->\r
39         <div id="alerts">\r
40                 <noscript>\r
41                         <p>\r
42                                 <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript\r
43                                 support, like yours, you should still see the contents (HTML data) and you should\r
44                                 be able to edit it normally, without a rich editor interface.\r
45                         </p>\r
46                 </noscript>\r
47         </div>\r
48         <!-- This <fieldset> holds the HTML code that you will usually find in your pages. -->\r
49         <form action="../sample_posteddata.php" method="post">\r
50                 <p>\r
51                         <label for="editor1">\r
52                                 Editor 1:</label>\r
53                 </p>\r
54                 <p>\r
55                 <?php\r
56                         // Include the CKEditor class.\r
57                         include_once "../../ckeditor.php";\r
58                         // The initial value to be displayed in the editor.\r
59                         $initialValue = '<p>This is some <strong>sample text</strong>.</p>';\r
60                         // Create a class instance.\r
61                         $CKEditor = new CKEditor();\r
62                         // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.\r
63                         //   $CKEditor->basePath = '/ckeditor/'\r
64                         // If not set, CKEditor will try to detect the correct path.\r
65                         $CKEditor->basePath = '../../';\r
66                         // Create a textarea element and attach CKEditor to it.\r
67                         $CKEditor->editor("editor1", $initialValue);\r
68                 ?>\r
69                         <input type="submit" value="Submit"/>\r
70                 </p>\r
71         </form>\r
72         <div id="footer">\r
73                 <hr />\r
74                 <p>\r
75                         CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>\r
76                 </p>\r
77                 <p id="copy">\r
78                         Copyright &copy; 2003-2012, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico\r
79                         Knabben. All rights reserved.\r
80                 </p>\r
81         </div>\r
82 </body>\r
83 </html>\r