Cdetailview - Create Link To Another Model

Hi All,

Learning Yii here for my next project. I have managed to display the related data of a model as seen below. but i want to make the “‘value’ => $show,” a link to the related model view. I tried placing CHtml::link(‘name’, ‘link’) in many parts of the below but in the view, it shows the tags eg. <a href=""> </a> instead of making the link. any help would be amazing! Thanks!


 <?php


$descs = array();

foreach($model->shows as $shows)

{

    $descs[] = $shows->Show_name;

	$id[] = $shows->ID;

}

$show = implode(', ', $descs);


$this->widget('zii.widgets.CDetailView', array(

    'data'=>$model,

    'attributes'=>array(

        array(

            'name' => 'Shows',

          'value' => $show,

		  )

	

    )

));


?>

append "type"=>"raw" after "value" or before


 <?php


$descs = array();

foreach($model->shows as $shows)

{

    $descs[] = $shows->Show_name;

        $id[] = $shows->ID;

}

$show = implode(', ', $descs);


$this->widget('zii.widgets.CDetailView', array(

    'data'=>$model,

    'attributes'=>array(

        array(

            'name' => 'Shows',

            'value' =>  CHtml::link('name', 'link') ,

            'type'=>'raw'

         )

        

    )

));


?>

Thanks for your quick reply! It worked, but it linked all the related data in one big link so i moved the link to be set in $descs see code below. Its the result i needed! Thanks again!


<?php


$descs = array();

foreach($model->shows as $shows)

{   $id = $shows->ID;

    $descs[] = CHtml::link($shows->Show_name, array('shows/view', 'id' => $id));

}

$show = implode(', ', $descs);


$this->widget('zii.widgets.CDetailView', array(

    'data'=>$model,

    'attributes'=>array(

        array(

          'name' => 'Shows',

          'value' => $show,

		  'type' => 'raw')

	

    )

));


?>

np glad could help. it looks ok