本文實(shí)例講述了Yii框架引用插件和ckeditor中body與P標(biāo)簽去除的方法。分享給大家供大家參考,具體如下:
在Yii中引用插件
注:插件和擴(kuò)展不一樣
1,源碼放在project/ckeditor/*
2,在代碼create,update中引用
Php代碼
<?php include_once "/ckeditor/ckeditor.php"; // Create a class instance. $CKEditor = new CKEditor(); // Path to the CKEditor directory. $CKEditor->basePath = Yii::app()->baseUrl.'/ckeditor/'; // Replace a textarea element with an id (or name) of "textarea_id". $CKEditor->replace("News_content"); ?>
引入插件方法二:
第一,比如說(shuō),我們要使用 Zend framework的東西。我們把zend framework解壓到 prtected/vendors里面,現(xiàn)在的文件夾為 protected/vendors/Zend/Search/Lucene.php
第二,在controller文件的頭部,插入下面代碼。
Yii::import('application.vendors.*'); require once('Zend/Search/Lucene.php');
上面代碼包含了Lucene.php這個(gè)類文件。因?yàn)槲覀冇玫降氖窍鄬?duì)路徑,所以我們需要改變PHP加載文件的路徑,Yii::import 一定要在require_once 之前。
第三,一旦我們?cè)O(shè)置好了,我們就可以在controller里面使用了。比如說(shuō)
$lucene=new Zend Search Lucene($pathOfIndex); $hits=$lucene->find(strtolower($keyword));
項(xiàng)目中使用到了ckeditor ,但在比編輯框的下方多出兩個(gè)標(biāo)簽,分別是一個(gè) body與P標(biāo)簽,查詢代碼后發(fā)現(xiàn)不是我們自己增加,而是組件自己就有的問(wèn)題
經(jīng)過(guò)查詢?cè)谑褂玫膉s申請(qǐng)?zhí)?新增
CKEDITOR.config.removePlugins='elementspath';
就能去除掉此標(biāo)簽
更多關(guān)于Yii相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Yii框架入門及常用技巧總結(jié)》、《php優(yōu)秀開(kāi)發(fā)框架總結(jié)》、《smarty模板入門基礎(chǔ)教程》、《php面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫(kù)操作入門教程》及《php常見(jiàn)數(shù)據(jù)庫(kù)操作技巧匯總》
希望本文所述對(duì)大家基于Yii框架的PHP程序設(shè)計(jì)有所幫助。