Yii error (The "dataProvider" property cannot be empty.)

Tried to use http://www.yiiframework.com/doc/api/1.1/CListView in modules

$da=new CActiveDataProvider('Page'); $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$da, 'itemView'=>'_post', )); 

lies in

 /protected/modules/page/views/admin/page.php 

The Page model lies in

 /protected/modules/page/models/Page.php 

and just in case put here))

 /protected/models 

did not help


Question: (Ale_x) and where is your code? in the controller or in the view ???

Answer: in the submission

  • and just try to create a Page model in the controller and perform some actions with it — what does it write? - Ale_x
  • right now I will try, can I contact you? have Skype? - do4a
  • skap, that is - I have 3-45 nights - everyone is asleep - so I sit quietly) - Ale_x
  • although it would be mesagi, that damn there is the same mistake, although this should not be - do4a
  • updated the answer - Ale_x

2 answers 2

show configuration file ?? Is there an autoload for your module files?

write like this

 'import'=>array( 'application.models.*', 'application.modules.*', 'application.components.*', ), 

yes by the way in the configs there is the modules parameter? should also be announced

  'modules'=>array('page', ...), 

in general, look here - there is an example of the code - it’s necessary. Now in Russian, create an instance of CActiveDataProvider - you must transfer it to the controller via a variable in the controller

  • is it main.php? 'import' => array ('application.models. *', 'application.modules. *', 'application.components. *',), - do4a
  • there it is written - do4a
  • application.models. * and application.models. - do we understand the difference? - Ale_x
  • there with * everything, apparently the editor has deleted, the modules have 'modules' => array (' page ',' gii '=> array (' class' => 'system.gii.GiiModule', 'password' => '123 ", // If removed, Gii defaults to localhost only. Edit carefully to taste. 'IpFilters' => array (),),), do4a
  • Pege class from which we inherit? - Ale_x

Obviously, you forgot to transfer dataProvider. There is an example of the link you specified, did you all do that?

  • $ da = new CActiveDataProvider ('Page'); $ this-> widget ('zii.widgets.CListView', array ('dataProvider' => $ da, 'itemView' => '_ post',)); lies in /protected/modules/page/views/admin/page.php The Page model lies in /protected/modules/page/models/Page.php and just in case put it here)) / protected / models did not help - do4a
  • updated the cap - do4a