Hi,
How can I display many many relation as a grid or list.
Scenario:
class Post extends CActiveRecord
{
public function relations()
{
return array(
'author'=>array(self::BELONGS_TO, 'User', 'author_id'),
'categories'=>array(self::MANY_MANY, 'Category',
'tbl_post_category(post_id, category_id)'),
);
}
}
In view.php of th "Post" model
How can I display $post->categories using a widget (CList or GridView)?
I can render sub view with foreach $post->categories as $category (and echo $category->name)
but I would like to use a widget.
<?php $this->widget(‘zii.widgets.CListView’, array(
'dataProvider'=> <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/huh.gif' class='bbc_emoticon' alt='???' />?,
'itemView'=>'_view',
)); ?>