How can I display html in view properly?

Hello,

My notes are currently showing as:

Telemetry<br>telepf<br><br>

How can I get them to display correctly in the view?

Thanks

Frank

Remove CHtml::encode(your_field) from your view. ;)

This is my view, NOTES is the field.




<?php $this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		'ID',

		'MasterId',

		'NOTES',

		'FUSER',

		'FDATE',

		'FUSERUPD',

		'FDATEUPD',

		'recordStatus',

	),

)); ?>



Read the documentation of ClistView, there is a nice example.

If you will check the property attributes you will find all info you need.

You have to specify the type as row, in order to prevent the attribute to be html-encoded.

In short, do like that:




<?php $this->widget('zii.widgets.CDetailView', array(

        'data'=>$model,

        'attributes'=>array(

                'ID',

                'MasterId',

                array(

                      'name'=>'NOTES',                 

                      'type'=>'row',                 

                ),

                'FUSER',

                'FDATE',

                'FUSERUPD',

                'FDATEUPD',

                'recordStatus',

        ),

)); ?>




Thanks, that did the trick.

Regards,

Frank

I am using yii-1.1.14

Got a CException Unknown type "row".

So I changed the type to ‘html’ and it works a treat.

Thanks everyone.

I think it was a typo and should have been ‘raw’.

Thanks for help

If you use ‘NOTES:html’ it does the trick. And with less typing.