URL Rewrite, link rewrite, controlle action

Hi everyone,

obviously I did not understand the url rewrite management. The thing I want to do is the following. I got this link:




'url'=>array($this->createUrl('/user/offers/',array('id'=>Yii::app()->user->id)))



I’d like to have this url: <domain>/user/<ID>/offers

Furthermore I’d like to have that this url points to my controller CategoryOfferController.php with the action ‘ViewOffersByUser’.

Can someone tell me how to accomplish this? I tried it hopelessly with url rewrite (‘offers/user/id/<id:\d+>’=>‘CategoryOffer/ViewOffersByUser’,) in the main.php file, without any luck

Thanks in advance!!

my main.php urlManager section:




'urlManager'=>array(

                	'urlFormat'=>'path',

                	'showScriptName'=>false,

                	'caseSensitive'=>false,

                	'rules'=>array(

                    	

                    	// offers

                    	'offers/user/id/<id:\d+>'=>'CategoryOffer/ViewOffersByUser',

                    	

                    	// GII

                    	'gii' => 'gii',

                    	'gii/<controller:\w+>' => 'gii/<controller>',

                    	'gii/<controller:\w+>/<action:\w+>' => 'gii/<controller>/<action>',

                	),

        	),



I think the pattern should be:




'offers/user/<id:\d+>/offers'=>'CategoryOffer/ViewOffersByUser',



Otherwise you’re saying you want to get this url: <domain>/user/id/<ID>/offers

Then, to get the link you should use (if I’m not wrong)




'url'=>array($this->createUrl('CategoryOffer/ViewOffersByUser',array('id'=>Yii::app()->user->id))



Great, works fantastically! Thanks a lot!