I’m developing a site where a lot of users will be subscribed. I thought, to view a user profile, I’ll do via the profile controller, example.com/profile/username, where “username” is somebody from the database.
class ProfileController extends Controller {
public function actionIndex($username) {
$user=tbl_users::model()->findByAttributes(array('username'=>$username));
if ($user === null)
throw new CHttpException(404,'User '.CHtml::encode($username).' not found!');
$this->render('index', array('user'=>$user));
}
}