我只想显示属于每个帖子的评论,
我已经这样做了:在帖子view.php中我渲染了一个视图:
<?php 
 $this->renderPartial('/TblComments/_comment',array(
     'comments'=>$model_comments,
        ));
?>
这是_comment.php 
<div class="view">
    <b><?php echo CHtml::encode($data->getAttributeLabel('id')); ?>:</b>
    <?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>
    <br />
    <b><?php echo CHtml::encode($data->getAttributeLabel('user_id')); ?>:</b>
    <?php echo CHtml::encode($data->user_id); ?>
    <br />
    <b><?php echo CHtml::encode($data->getAttributeLabel('post_id')); ?>:</b>
    <?php echo CHtml::encode($data->post_id); ?>
    <br />
    <b><?php echo CHtml::encode($data->getAttributeLabel('comment_body')); ?>:</b>
    <?php echo CHtml::encode($data->comment_body); ?>
    <br />
        <?php echo CHtml::link('Edit', array('tblComments/update', 'id'=>$data->id)); ?>
        <br/>
        <?php echo CHtml::link('Delete', array('tblComments/delete', 'id'=>$data->id)); ?>
</div>
现在的问题是:
Undefined variable: data 
我不知道为什么 ?请解释并帮助我!