本文實(shí)例講述了Yii框架引用插件和ckeditor中body與P標(biāo)簽去除的方法。分享給大家供大家參考,具體如下:
在Yii中引用插件
注:插件和擴(kuò)展不一樣
	1,源碼放在project/ckeditor/*
	2,在代碼create,update中引用
Php代碼
<?phpinclude_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");?>引入插件方法二:
第一,比如說,我們要使用 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里面使用了。比如說
$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)不是我們自己增加,而是組件自己就有的問題
經(jīng)過查詢?cè)谑褂玫膉s申請(qǐng)?zhí)?新增
CKEDITOR.config.removePlugins='elementspath';
就能去除掉此標(biāo)簽
希望本文所述對(duì)大家基于Yii框架的PHP程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選