Use http methods/verbs in your application rules
how to install:
Im assuming its not the first time you are using yii's UrlManager
To set up, download the file attached, put it in your components folder or any other folder imported in your initial configuration
and then in your configuration options (configs/main.php probably) add the following line
'urlManager'=>array(
'class'=>'VerbUrlManager',//this line
//or 'class'=>'application.extensions.verburlmanager.VerbUrlManager'
how to use :
'rules'=>array(
//rules applied to all kind of requests if a specific verbs/method rule does not match/trigger first
'<_c:\w*>/<_a:\w+>/<id:\d+>'=>'<_c>/<_a>',
//rules for post requests
'@post'=>array(
'<_c:\w+>'=>'<_c>/create',
'<_c:\w+>/<id:\d+>'=>'<_c>/update',
),
//rules for put requests
'@put'=>array(
'<_c:\w+>'=>'<_c>/create',
'<_c:\w+>/<id:\d+>'=>'<_c>/update',
),
'@get'=>array(
'<_c:\w+>'=>'<_c>/list',
'<_c:\w+>/<id:\d+>'=>'<_c>/details',
'<_c:\w+>/<_a:\w+>/<q:\w+>'=>'<_c>/search',
),
//case insensitive
'@DELETE'=>array(
'<_c:\w+>'=>'error/400',
'<_c:\w+>/<id:\d+>'=>'<_c>/delete',
),
//rule is a string, which means that all requests go to a fixed route
'@HEAd'=>'error/501'
)extension link
----------------------
Quote
This post has been edited by Gustavo: 21 January 2011 - 11:19 PM

Help












