function create($fieldName, $options = array(), $id_replace = '') { // Mặc định nếu ko định nghĩa chọn toolbar loại nào sẽ sử dụng loại simple // Mặc định nếu ko định nghĩa chọn ngôn ngữ nào loại nào sẽ sử dụng ngôn ngữ tiếng việt $options += array('toolbar' => 'simple', 'language' => 'vi', 'width' => 900); //định nghĩa trước một số kiểu toolbar trước switch ($options['toolbar']) { case 'extra': $options['toolbar'] = array(array('Source'), array('Preview'), array('PasteFromWord', '-', 'Print'), array('Undo', 'Redo', '-', 'Find', 'Replace', '-', 'RemoveFormat'), array('Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript'), array('NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'), array('JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'), array('Link', 'Anchor'), array('Image', 'Flash', 'oembed', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'), array('Styles', 'Format', 'Font', 'FontSize'), array('TextColor', 'BGColor'), array('ShowBlocks', 'Maximize')); /* * Nếu bạn khai báo phần tử image,flash,file và cho phép người sử dụng upload lên server thì phải cài đặt các chức năng tương ứng sau */ /* File upload url */ $options['filebrowserUploadUrl'] = $this->webroot . "js/ckeditor/kcfinder/upload.php?type=files"; /* Image upload url */ $options['filebrowserImageUploadUrl'] = $this->webroot . "js/ckeditor/kcfinder/upload.php?type=images"; /* Flash upload url */ $options['filebrowserFlashUploadUrl'] = $this->webroot . "js/ckeditor/kcfinder/upload.php?type=flash"; /* Xem file đã upload */ $options['filebrowserBrowseUrl'] = $this->webroot . "js/ckeditor/kcfinder/browse.php?type=files"; /* Xem images đã upload */ $options['filebrowserImageBrowseUrl'] = $this->webroot . "js/ckeditor/kcfinder/browse.php?type=images"; /* Xem flash đã upload */ $options['filebrowserFlashBrowseUrl'] = $this->webroot . "js/ckeditor/kcfinder/browse.php?type=flash"; break; case 'users': $options['toolbar'] = array(array('Preview', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'), array('Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Anchor', 'Image', 'Table', 'Smiley'), array('FontSize', 'TextColor', 'BGColor'), array('Undo', 'Redo', 'RemoveFormat', 'PasteFromWord'), array('Maximize')); break; /* your case here ... */ /* your case here ... */ default: $options['toolbar'] = array(array('Preview', 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Smiley', 'SpecialChar'), array('FontSize', 'TextColor', 'BGColor'), array('RemoveFormat')); } require_once WWW_ROOT . 'js' . DS . 'ckeditor' . DS . 'ckeditor.php'; $CKEditor = new CKEditor(); $CKEditor->basePath = $this->webroot . 'js/ckeditor/'; $CKEditor->config = $options; //$attributes = $this->Form->_initInputField($fieldName, array()); //return $CKEditor->editor($fieldName,$value); return $CKEditor->replace($id_replace); //return $CKEditor->replace($attributes['id'],$options); //$attributes = $this->Form->_initInputField($fieldName, array()); //return $this->Html->scriptBlock("CKEDITOR.replace('" . $attributes['id'] . "',{{$this->Js->_parseOptions($options)}});"); }
<p> <input type="submit" value="Submit" /> </p> </form> <div id="footer"> <hr /> <p> CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a> </p> <p id="copy"> Copyright © 2003-2011, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico Knabben. All rights reserved. </p> </div> <?php // Include the CKEditor class. include_once "../../ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // 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 = '../../'; // Replace a textarea element with an id (or name) of "editor1". $CKEditor->replace("editor1"); ?> </body> </html>
<html> <head> <title>admin - epaper</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <h1>發送電子報</h1> <?php include 'bar.php'; ?> <form method="POST" action="epaper_send_exe.php"> 標題:<input type="text" name="epaperSubject"><br> 內容:<textarea name="epaperContent"></textarea><br> <?php include '../ckeditor/ckeditor.php'; $CKEditor = new CKEditor(); $CKEditor->config['width'] = 600; $CKEditor->basePath = '../ckeditor/'; $CKEditor->replace("epaperContent"); ?> <input type="submit" value="送出"> </form> </body> </html>
if (is_file($rutaPadre) and substr($rutaPadre, -4) == "html") { $gestor = fopen($rutaPadre, "r"); $archtml = fread($gestor, filesize($rutaPadre)); $archtml = preg_replace('/<img (.+?)>/', ' ', $archtml); $archtml = preg_replace('COLOR: red;', ' ', $archtml); $config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier(); $clean_html = $purifier->purify($archtml); $asunto .= "<br><br><hr><br>\r\n {$clean_html}"; } $smarty->assign("sid", SID); //Envio de session por get $smarty->assign("usuacodi", $usuacodi); $smarty->assign("extn", $extn); $smarty->assign("depecodi", $depecodi); $smarty->assign("codigoCiu", $codigoCiu); $smarty->assign("radPadre", $radicado); $smarty->assign("rutaPadre", $rutaPadre); $smarty->assign("usuanomb", $usuanomb); $smarty->assign("usualog", $usualog); $smarty->assign("destinatario", $destinatario); //$smarty->assign("concopia" , ""); //$smarty->assign("concopiaOculta" , ""); $smarty->assign("asunto", $asunto); $smarty->assign("emails", $emails); $smarty->assign("docAnex", $aneNombDoc); $smarty->display('index.tpl'); // Replace a textarea element with an id (or name) of "textarea_id". $CKEditor->config['height'] = 575; $CKEditor->replace("texrich");
<option value="2">Hindi</option> <option value="3">Maths</option> <option value="4">Science</option> <option value="5">Social Science</option> </select></p> <p>Link<br /> <input type="text" name="link" value="http://"/></p> <p>Expiry Date<br /> <input type="text" class="date" name="expiry" /></p> <?php $action = $_GET['type']; echo '<input type= "hidden" name="type" value="' . $action . '" />'; if ($action == 'upload') { echo '<p>Upload<br /><input type="file" name="doc" /></p>'; } else { if ($action == 'publish') { echo '<p>Content<br /><textarea id="editor" name="content"></textarea></p>'; require_once "../../ui/ckeditor/ckeditor.php"; $CKEditor = new CKEditor(); $CKEditor->basePath = '/ckeditor/'; $config = array(); $config['skin'] = 'office2003'; $config['width'] = '900'; $CKEditor->replace("editor", $config); } } ?> <input type="submit" value="Submit" name="tutorial" /> </form> </body>
"><br> 商品售價:<input type="text" name="productPrice" value="<?php echo $record['productPrice']; ?> " size="5" maxlength="5"><br> 庫存數量:<input type="text" name="productStock" value="<?php echo $record['productStock']; ?> " size="5" maxlength="5"><br> 商品圖片:<input type="file" name="productPic" value="123"><br> 商品摘要:<textarea name="productAbstract"><?php echo $record['productAbstract']; ?> </textarea><br> 商品內容:<textarea name="productContent"><?php echo $record['productContent']; ?> </textarea><br> <?php include '../ckeditor/ckeditor.php'; $CKEditor = new CKEditor(); $CKEditor->basePath = '../ckeditor/'; $CKEditor->replace("productContent"); ?> <input type="submit" value="送出"> </form> </body> </html>
</p> </p> <?php } ?> <p> </p></td> </tr> </table> </td> </tr> <tr> <td bgcolor="#FFFFFF"> </td> </tr> </table> <?php // Include CKEditor class. include_once "../js/ckeditor/ckeditor.php"; // Create class instance. $CKEditor = new CKEditor(); // Path to CKEditor directory, ideally instead of relative dir, use an absolute path: // $CKEditor->basePath = '/ckeditor/' // If not set, CKEditor will try to detect the correct path. $CKEditor->basePath = '../js/ckeditor/'; // Replace textarea with id (or name) "editor1". $CKEditor->replace("policy"); $CKEditor->replace("policyes"); ?> </body> </html>