Bascic Yii help


public function actionJsonView()

{

	$model=Employees::model()->find((int)$_GET["id"]);

	if($model===null)

		throw new CHttpException(404,'The requested page does not exist.');

}

I access it as r=employees/view&id=51 only

The above code works fine but if i change it to


public function actionJsonView($id)

{

	$model=Employees::model()->find((int)$id);

	if($model===null)

		throw new CHttpException(404,'The requested page does not exist.');

}

It always goes to 404. This is who i access r=employees/view/51.

First is this possible or i have to acess it as r=employees/view&id=51 only

Your question is a bit unclear…

Do you get the error 400 or 404?

The first example that you say it works… do you access it with r=employees/view/51or r=employees/view&id=51.

Anyway the URL you will use depends on the rules you set for urlManager in the config (protected/config/main.php)

Only GET ( employees/view&id=51 only )

Yii documentation