Last active
August 28, 2021 10:33
-
-
Save MasterHans/bc22335d16fff551540d99353c99a586 to your computer and use it in GitHub Desktop.
Передаём критерии (набор параметров для sql запроса) в DataProvider , который мы вставим в Грид (или Лист) во вью
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Controller: | |
$dataProvider=new CActiveDataProvider('Comment', array( | |
'criteria'=>array( | |
'with'=>'post', | |
'order'=>'t.status, t.create_time DESC', | |
), | |
)); | |
$this->render('index',array( | |
'dataProvider'=>$dataProvider, | |
)); | |
View: | |
<h1>Comments</h1> | |
<?php $this->widget('zii.widgets.CListView', array( | |
'dataProvider'=>$dataProvider, | |
'itemView'=>'_view', | |
)); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment