Some Questions About Gridview?

Hi, All.

It’s better to explain my questions using demo from yii. So I have demo of blog in yii. By the default all post shows like a list. I would like to see posts in this way:

post1 | post2 | post3

post4 | post5 | post6

post7 | post8 | post9

So I’ve decide to use the CGridView. I’ve changed the /view/post/index.php like this:


<?php 

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

//	'dataProvider'=>$dataProvider,

//	'itemView'=>'_view',

//	'template'=>"{items}\n{pager}",

//)); 


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

    'dataProvider'=>$dataProvider,

    //'itemView'=>'_view',

    'template'=>"{items}\n{pager}",

));

?> 

But it works in not proper way. It’s rendered simple table.

My questions:

  1. Is it right way to do this (I mean in general using GridView. May be there is different way?)?

  2. Why I can’t use itemView with CGridView?

  3. How I can render page with this conditions?

Giulia

PS. Sorry. I know it’s stupid questions, but I’m newbie in yii.

I think you’re after CListView.

I’ve read that itemView works only with CListView. But how I can render posts using CListView? I didn’t understand. Like list - yes… but in my case??

Keith, thanks. Your advice was excellent. I did it))))