About yw0

Hi there,

Happy new year to all =D

I have just started using yii yesterday, so please bear with me if my question sounds silly

I notice that every generated pages of yii always have "id=yw0"

<div id="yw0" class="list-view">

Which file should I edit to change yw0 to something else?

Also, is it possible to remove the id attribute so that it becomes <div class="list-view">?

Please help

Most of the Yii widgets will have an “id” property that you can set at initialization and in case you don’t set it, then it will show that auto-generated id.

I.E:




$this->widget('zii.widgets.grid.CGridView', array(

    	'id'=>$modelName.'-grid',//if i wouldn't set it here, Yii would generate it for me.

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

    	'filter'=>$location,

        'filterPosition'=>'footer',

        'filterCssClass'=>'hidden',

        'itemsCssClass'=>'items',

        'selectableRows'=>0,

[...]



To remove the id, i think you can just set it to null (didn’t tried).

To give the widget a certain class, use the htmlOptions property, almost all the widgets have this.

To be sure that you pass the right properties, just use the documentation and see what properties are available for the widget you use.

Thanks Twisted.

It does work.

I also tried set the id to be null, and it becomes:

<div id="" class="list-view">

But well… that’s ok for me