首页 > 语言 > PHP > 正文

Yii框架引用插件和ckeditor中body与P标签去除的方法

2024-05-04 23:54:31
字体:
来源:转载
供稿:网友

本文实例讲述了Yii框架引用插件和ckeditor中body与P标签去除的方法。分享给大家供大家参考,具体如下:

在Yii中引用插件

注:插件和扩展不一样

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里面,现在的文件夹为 protected/vendors/Zend/Search/Lucene.php

第二,在controller文件的头部,插入下面代码。

Yii::import('application.vendors.*');require once('Zend/Search/Lucene.php');

上面代码包含了Lucene.php这个类文件。因为我们用到的是相对路径,所以我们需要改变PHP加载文件的路径,Yii::import 一定要在require_once 之前。

第三,一旦我们设置好了,我们就可以在controller里面使用了。比如说

$lucene=new Zend Search Lucene($pathOfIndex);$hits=$lucene->find(strtolower($keyword));

项目中使用到了ckeditor ,但在比编辑框的下方多出两个标签,分别是一个 body与P标签,查询代码后发现不是我们自己增加,而是组件自己就有的问题

经过查询在使用的js申请处 新增

CKEDITOR.config.removePlugins='elementspath';

就能去除掉此标签

希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。


注:相关教程知识阅读请移步到PHP教程频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选