I want to deal with the dynamic action on the fly using one static action browse, I encounter an

unable to resolve the request "item/xxx-yyy-zzz" error.

I found this (http://www.yiiframework.com/forum/index.php/topic/33344-create-dynamic-action-in-controller-file/) is similar to what i want to do.

I have set the urlManager as below.


		'caseSensitive' => false,



			'item/<href:[^ ]*]+>'=>'items/browse',






and here is my controller.

public function accessRules()


	return array(

		array('allow',  // allow all users to perform 'index' and 'view' actions

			'actions'=>array('index', 'browse', 'list'),



		array('allow', // allow authenticated user to perform 'create' and 'update' actions




		array('allow', // allow admin user to perform 'admin' and 'delete' actions

			'actions'=>array('admin','delete', 'create','update'),



		array('deny',  // deny all users





public function actionBrowse($href)






public function loadModelByHref($href)


	$criteria=new CDbCriteria();

	$criteria->condition = 'href=:href';

	$criteria->params = array(':href'=>$href);

	$model = Item::model()->find($criteria);


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

	return $model;


Anything I missed or programmed incorrectly?

Please help, thx

'item/<href:[^ ]*]+>'=>'items/browse',

there is additional "]" and "*" that are not quoted in regexp… it should be sth like:

'item/<href:[^ ]+>'=>'items/browse',


"item/<href:[^ \\]*]+>"=>'items/browse',


thx for your help, it works.

I have tested my regular expression using some testing ‘href’ in the web, but don’t know why it will fail.