How to set common attributes:
Example:
$this->widget('zii.widgets.CListView', array('dataProvider'=>$book->search(),'itemView'=>'_book','pager'=>array('class'=>'CLinkPager','header'=>'Visit to page','firstPageLabel'=>'<<','prevPageLabel'=>'<','nextPageLabel'=>'>','lastPageLabel'=>'>>',)));
When we need to process a specific _ view of an iteration, we can use the $ index variable for some logic processing, so that we can better modify layout and so on.
<!-- inside your CListView's itemView partial --><div class="<?= ($index % 2) ? 'odd' : 'even' ?>">...
Then, process in CSS:
.odd {background:yellow;}.even{background:gray;}
Of course, there is also a walk around method that can achieve the same effect:
We can use js to process the page (similar to the following)
Function _ layout_init (){
// Modify layout of ads in news create/Edit page
If ($ ("# div-ID"). length> 0 ){
$ ("# Div-ID Div. Items Div. View: eq (4)" example .css ("margin-Right", "0 ");
$ ("# Div-ID Div. Items Div. View: eq (9)" ).css ("margin-Right", "0 ");
}
}
Then you can call it on the specific display page (usually in layout, as shown below:
$ (Document). Ready (function (){
$ ("# Content"). ajaxstop (function (){
_ Layout_init ();
});
});
Of course, here is just a simple introduction of a solution, the extra improvement is still necessary, O (∩ _ ∩) O ~