X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_samples%2Fphp%2Fadvanced.php;h=1d62ce5e2c5ce7bdd5b3d254daa14a85ad8e7168;hp=771cb0cad5399d74a302bb00a5ae7d5b6e1e83fc;hb=48b1db88210b4160dce439c6e3e32e14af8c106b;hpb=9afde8772159bd3436f1f5b7862960307710ae5a diff --git a/_samples/php/advanced.php b/_samples/php/advanced.php index 771cb0c..1d62ce5 100644 --- a/_samples/php/advanced.php +++ b/_samples/php/advanced.php @@ -1,18 +1,52 @@ - Sample - CKEditor + Setting Configuration Options — CKEditor Sample -

- CKEditor Sample +

+ CKEditor Sample — Setting Configuration Options

+

+ This sample shows how to insert a CKEditor instance with custom configuration options. +

+

+ To set configuration options, use the config property. To set the attributes of a <textarea> element (which is displayed instead of CKEditor in unsupported browsers), use the textareaAttributes property. +

+
+<?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/';
+
+// Set global configuration (used by every instance of CKEditor).
+$CKEditor->config['width'] = 600;
+
+// Change default textarea attributes.
+$CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10);
+
+// The initial value to be displayed in the editor.
+$initialValue = 'This is some sample text.';
+
+// Create the first instance.
+$CKEditor->editor("textarea_id", $initialValue);
+?>
+

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

+
- -
- Output -
-

-
-

+ + returnOutput = true; -// Path to CKEditor directory, ideally instead of relative dir, use an absolute path: +// Path to the CKEditor directory, ideally use an absolute path instead of a relative dir. // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../../'; @@ -48,22 +77,21 @@ $CKEditor->basePath = '../../'; // Set global configuration (will be used by all instances of CKEditor). $CKEditor->config['width'] = 600; -// Change default textarea attributes +// Change default textarea attributes. $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10); // The initial value to be displayed in the editor. $initialValue = '

This is some sample text. You are using CKEditor.

'; -// Create first instance. +// Create the first instance. $code = $CKEditor->editor("editor1", $initialValue); echo $code; ?> -

-
-

+
+ editor("editor2", $initialValue, $config); ?> -

- -

-
-
+

+ +

+