php - Yii: Reference to an other object -
how can change view.php
code (as autogenerated gii of yii framework) show link object (with title , link), instead of simple numeric id?
<b><?php echo chtml::encode($data->getattributelabel('employee')); ?>:</b> <?php echo chtml::encode($data->employee); ?> <br />
i can findbypk
, chtml::link
, maybe there shorter way? please give me shortest code this.
assuming route view employee employee/view
, name stored in name
, id in id
, shortest way code be:
chtml::link(chtml::encode($data->employee->name), array('employee/view', 'id' => $data->employee->id));
Comments
Post a Comment