My Action in Controller is
//========================
public function actionIndex() {
$this->layout = 'column3';
$model = new Projects('search');
$model->unsetAttributes();
$test = $model->contact_id = Yii::app()->User->id;
$myid = Projects::model()->findByAttributes(
array(
'contact_id' => $test
));
$notes = Notes::model()->findByAttributes(array(
'parent_id' => $myid->id,
'parent_type' => "Projects"
));
$this->render('index', array(
'model' => $model,
'notes' => $notes
));
}
//==============My view file Index.php having BListView is============
<?php
$this->widget(‘bootstrap.widgets.TbListView’, array(
'dataProvider'=>$model->search(),
'itemView'=>'_view',
));
?>
//============= _view file is here====================================
<div class="view">
<b><strong> <?php echo CHtml::encode($data->getAttributeLabel('name')); ?></strong>:</b>
<?php echo CHtml::encode($data->name); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('start_date')); ?>:</b>
<?php echo CHtml::encode($data->start_date); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('end_date')); ?>:</b>
<?php echo CHtml::encode($data->end_date); ?>
<br />
<h5>Notes</h5>
<?php
foreach ($notes as $notes) {
echo $note->description;
}
?>
<hr>
</div>