news page

Hi all

new to Yii… loving it so far …but I’m having trouble finding a feature.

I have a site currently that has a news page.

on that page I show 4 to 5 news item and then send them off to archives.

news items are entered via a form that only the administrator has access to and news items are stored in DB

users can’t leave comments on the news item. simply view them.

is there an existing extension/widget that does this?



Yes, there is: CListView.

you would not have a link to decent example using that class by any chance?

Your requirements are touching on a few criteria - access rules, display, storage etc.

CListView is a widget for display purposes.

Use it like so:


public function actionImageAdmin($id)


        $model = $this->loadModel($id);

        $imageDataProvider = new CActiveDataProvider('PortfolioImage', array(

                'criteria' => array(

                    'condition' => 'portfolio_id=:modelId',

                    'params' => array(

                        ':modelId' => $model->id,




        $this->render('/index', array(

            'imageDataProvider' => $imageDataProvider,

            'model' => $model,





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

    'dataProvider' => $imageDataProvider,

    'itemView' => '/path/to/view/file',

    'sortableAttributes' => array(


        'create_time' => 'Post Time',