X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_samples%2Fphp%2Freplace.php;h=d22dcb7cc4fffa5dd98d9f9f28c7ac0c567edd00;hp=80d813bda8e1f50a68aeb81a7fcf45dcd3ea0fb9;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hpb=9afde8772159bd3436f1f5b7862960307710ae5a diff --git a/_samples/php/replace.php b/_samples/php/replace.php index 80d813b..d22dcb7 100644 --- a/_samples/php/replace.php +++ b/_samples/php/replace.php @@ -1,18 +1,46 @@ - Sample - CKEditor + Replace Selected Textarea Elements — CKEditor Sample -

- CKEditor Sample +

+ CKEditor Sample — Replace Selected Textarea Elements Using PHP Code

+
+

+ This sample shows how to replace a selected <textarea> element + with a CKEditor instance by using PHP code. +

+

+ To replace a <textarea> element, place the following call at any point + after the <textarea> element: +

+
+<?php
+// Include the CKEditor class.
+include_once "ckeditor/ckeditor.php";
+
+// Create a class instance.
+$CKEditor = new CKEditor();
+
+// Path to the CKEditor directory.
+$CKEditor->basePath = '/ckeditor/';
+
+// Replace a textarea element with an id (or name) of "textarea_id".
+$CKEditor->replace("textarea_id");
+?>
+

+ Note that textarea_id in the code above is the id attribute of + the <textarea> element to be replaced. +

+
- -
- Output -
-

-
- -

-

- -

-
-
+
+

+ + +

+

+ +

+
basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; - // Replace textarea with id (or name) "editor1". + // Replace a textarea element with an id (or name) of "editor1". $CKEditor->replace("editor1"); ?>