Problem Injecting Html In A Cgridview

Hi everybody

i’m having trouble with this piece of code:




<?php $this->widget('bootstrap.widgets.TbGridView',array(

	'id'=>'prodotti-grid',

	'dataProvider'=>$model->search(),

        'type'=>'striped bordered condensed',

        'template'=>'{summary}{pager}{items}{pager}',

	'columns'=>array(

                'codice',

                'nome',

		'descrizioneBreve',

                array('name'=>'schedaTecnica',

                      'htmlOptions'=>array('width'=>'540'), 

                      'type'=>'html',

                      'value'=>function($data){

                            $CHtmlPurifier = new CHtmlPurifier();

                             $CHtmlPurifier->options = array('HTML.AllowedElements' => array());

                            $purified = $CHtmlPurifier->purify($data->schedaTecnica);

                        return '<div style="overflow:hidden; height:200px;">' . $purified . '</div>';

                      } 

                ),

[cut]



the problem is in this line:

return ‘<div style=“overflow:hidden; height:200px;”>’ . $purified . ‘</div>’;

some css rules are not applied at all (like overflow:hidden) but the height rule is applied succesfully

No errors are thrown

what can be the cause?

Thanks in advance

p.s. i solved by using rules in a css file, but i’m still wondering why using inline css doesn’t work…

Out of interest, try changing the type from ‘html’ to ‘raw’.

I take it you’ve looked at the page source to confirm that the overflow css rule isn’t being output?

In any case, HTML content is sent through the HTML purifier, while raw content isn’t.

Thank you, changing the type to raw works, and now i see the difference between those two types…

Happy coding