Hi,
What would be the best way to show children in a view?
Ive got one table: Users
id
name
lastName
image
reportsTo
reportsTo contains an id from Users table and i need to show all users that report to current user in the view (just below "reporters" field.
/protected/views/users/_view.php
<div class="view">
<?php echo CHtml::image(Yii::app()->request->baseUrl.'/images/users/'.$data->image, 'user', array('style'=>"border: 1px solid #999; display: inline-block; float: right;")); ?>
<h2><?php echo CHtml::link(CHtml::encode($data->name.' '.$data->lastName), array('update', 'id'=>$data->id)); ?></h2>
<b><?php echo CHtml::encode($data->getAttributeLabel('reportsToId')); ?>:</b>
<?php echo CHtml::link(CHtml::encode($data->reportsTo->name.' '.$data->reportsTo->lastName), array('view', 'id'=>$data->reportsTo->id)); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('reporters')); ?>:</b>
</div>
Thank you in advance