standalone.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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-2011, 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>Creating CKEditor Instances &mdash; 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 &mdash; Creating CKEditor Instances
  15. </h1>
  16. <div class="description">
  17. <p>
  18. This sample shows how to create a CKEditor instance with PHP.
  19. </p>
  20. <pre class="samples">
  21. &lt;?php
  22. include_once "ckeditor/ckeditor.php";
  23. // Create a class instance.
  24. $CKEditor = new CKEditor();
  25. // Path to the CKEditor directory.
  26. $CKEditor->basePath = '/ckeditor/';
  27. // Create a textarea element and attach CKEditor to it.
  28. $CKEditor->editor("textarea_id", "This is some sample text");
  29. ?&gt;</pre>
  30. <p>
  31. Note that <code><em>textarea_id</em></code> in the code above is the <code>id</code> and <code>name</code> attribute of
  32. the <code>&lt;textarea&gt;</code> element that will be created.
  33. </p>
  34. </div>
  35. <!-- This <div> holds alert messages to be display in the sample page. -->
  36. <div id="alerts">
  37. <noscript>
  38. <p>
  39. <strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
  40. support, like yours, you should still see the contents (HTML data) and you should
  41. be able to edit it normally, without a rich editor interface.
  42. </p>
  43. </noscript>
  44. </div>
  45. <!-- This <fieldset> holds the HTML code that you will usually find in your pages. -->
  46. <form action="../sample_posteddata.php" method="post">
  47. <p>
  48. <label for="editor1">
  49. Editor 1:</label>
  50. </p>
  51. <p>
  52. <?php
  53. // Include the CKEditor class.
  54. include_once "../../ckeditor.php";
  55. // The initial value to be displayed in the editor.
  56. $initialValue = '<p>This is some <strong>sample text</strong>.</p>';
  57. // Create a class instance.
  58. $CKEditor = new CKEditor();
  59. // Path to the CKEditor directory, ideally use an absolute path instead of a relative dir.
  60. // $CKEditor->basePath = '/ckeditor/'
  61. // If not set, CKEditor will try to detect the correct path.
  62. $CKEditor->basePath = '../../';
  63. // Create a textarea element and attach CKEditor to it.
  64. $CKEditor->editor("editor1", $initialValue);
  65. ?>
  66. <input type="submit" value="Submit"/>
  67. </p>
  68. </form>
  69. <div id="footer">
  70. <hr />
  71. <p>
  72. CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
  73. </p>
  74. <p id="copy">
  75. Copyright &copy; 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
  76. Knabben. All rights reserved.
  77. </p>
  78. </div>
  79. </body>
  80. </html>