I have Users pages. In index view they all have hyperlinks on ID, and so they are sending ID to model. And when u press the link the users View is loaded and the url becomes
/site/users/1
But what I want is the URL to be not users ID but users Username like
/site/users/Alex
How can I do it ? This is my _view
<?php echo CHtml::link(CHtml::encode($data->id), array('view', 'id'=>$data->id)); ?>
Controller
public function actionView($id)
{
$this->render('view',array(
'model'=>$this->loadModel($id),
));
}