CHtml Purifier

Hi,

I want to remove the html tags which are displayed as below:

Output:

View MiscellaneousPages #7

Page Name hty

Page Text <p>&nbsp;tyt</p>

I have used fckeditor and the code for the same is as follows:

<div class="form">

<?php $form=$this->beginWidget(‘CActiveForm’, array(

'id'=&gt;'miscellaneous-pages-form',


'enableAjaxValidation'=&gt;false,

)); ?>

&lt;p class=&quot;note&quot;&gt;Fields with &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt; are required.&lt;/p&gt;





&lt;?php echo &#036;form-&gt;errorSummary(&#036;model); ?&gt;











&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'page_name'); ?&gt;


	&lt;?php echo &#036;form-&gt;textField(&#036;model,'page_name',array('size'=&gt;60,'maxlength'=&gt;100)); ?&gt;


	&lt;?php echo &#036;form-&gt;error(&#036;model,'page_name'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row&quot;&gt;


	&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'page_text'); ?&gt;


	&lt;?php &#036;this-&gt;widget('application.extensions.fckeditor.FCKEditorWidget',array(

‘model’ => $model,

‘attribute’ => ‘page_text’,

‘height’ => ‘600px’,

‘width’ => ‘100%’,

‘fckeditor’ => dirname(Yii::app()->basePath).’/protected/extensions/fckeditor/fckeditor.php’,

‘fckBasePath’ => Yii::app()->baseUrl.’/fckeditor/’)

); ?>

	&lt;?php echo &#036;form-&gt;error(&#036;model,'page_text'); ?&gt;


&lt;/div&gt;





&lt;div class=&quot;row buttons&quot;&gt;


	&lt;?php echo CHtml::submitButton(&#036;model-&gt;isNewRecord ? 'Create' : 'Save'); ?&gt;


&lt;/div&gt;

<?php $this->endWidget(); ?>

</div><!-- form -->

I want to remove the html tags which are displayed?

Thanks

Do you want to remove all HTML tags?

You could do it like this:

[list=1][]Add inline validator to your model’s rules().[]Add function to your model that purifies the input.[/list]

If you don’t want any HTML tags, then why are you using a HTML editor ?? ???!

I believe what is required is that the formatting should be done and the tags should be in source that is if something is <strong>Bold Text</strong> created in fckeditor or tinymce.

It should show as Bold Text in the view(for the frontend).

I have the same issue

Oh, I get it now.

Set the type to ‘raw’ in your listview (‘type’ => ‘raw’,) and Yii will not call html entities on it. :)

Hi,

I am getting error which states Property "CListView.type" is not defined.

I have added the type=raw in the protected views file as follows:

<?php $this->widget(‘zii.widgets.CListView’, array(

 'dataProvider'=&gt;&#036;dataProvider,


'itemView'=&gt;'_view',


 'type'=&gt;'raw',

)); ?>

Thanks,

Will it be there when declaring $dataProvider?

$dataprovider is defined in the controller class in the index method and it is required. I still can’t get the the text displayed without html tags.

I have used fckeditor where the user can write his content and when the same content is viewed, it is displayed with html tags, hello world is displayed as <p>hello world</p>. I don’t want the html tags to be displayed, I just want it as hello world.

Thanks,

Problem solved.I used php strip tags.

Thanks,