SoFunction
Updated on 2025-03-10

Yii framework references plug-in and ckeditor to remove body and P tags

This article describes the method of removing body and P tags in Yii framework reference plug-in and ckeditor. Share it for your reference, as follows:

Quoting plugin in Yii

Note: Plugins and extensions are different

1. The source code is placed in project/ckeditor/*
2. Reference in code create, update

Php code

<?php
include_once "/ckeditor/";
// 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");
?>

Method 2 of introducing plug-in:

First, for example, we want to use Zend framework stuff. We unzip the zend framework into prtected/vendors, and the current folder is protected/vendors/Zend/Search/

Second, insert the following code at the head of the controller file.

Yii::import('.*');
require once('Zend/Search/');

The above code contains this class file. Because we are using relative paths, we need to change the path of PHP loading file. Yii::import must be before require_once.

Third, once we set it up, we can use it in the controller. For example

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

The ckeditor is used in the project, but there are two more labels than the bottom of the editing box, namely a body and a P tag. After querying the code, it is found that it is not the problem that we add ourselves, but the components themselves have.

After query, add new js application office

='elementspath';

This tag can be removed

For more information about Yii, readers who are interested in this site can view the topic:Yii framework introduction and common techniques summary》、《Summary of excellent development framework for php》、《Basic tutorial on getting started with smarty templates》、《PHP object-oriented programming tutorial》、《Summary of usage of php strings》、《PHP+mysql database operation tutorial"and"Summary of common database operation techniques for php

I hope that this article will be helpful to everyone's PHP programming based on the Yii framework.