Fatal error: Call to a member function getData() on a non-object in /data/php/framework/exts/zii/wid

使用Yii框架的zii.widgets.CListView遇到的错误:zii.widgets.CListView

<?php $this->widget('zii.widgets.CListView', array(
            'dataProvider' => $order,
            'itemView' => '_providerlist',
            'emptyText' => '暂无数据',
            'itemsTagName'=>'div',
            'template'=>'{items}{pager}',
            'pagerCssClass' => 'page mt20',
            'pager'=>Mod::app()->params->pagerConfig,
            'viewData' => array('year'=>$year,'month'=>$month)
        )); ?>

Fatal error: Call to a member function getData() on a non-object in /data/php/framework/exts/zii/widgets/CBaseListView.php

原因:$order不是dataProvider的对象。

解决方法:

 $order = new CArrayDataProvider($order, array( 'pagination'=>array('pageSize'=>5) ) );

你可能感兴趣的:(PHP,框架,yii,widget)