Catch All For An Add/create Action

Hello all.

Anyone know how i can do a catch all that sees the ‘add’ action and forward to an action to do an add with $itemdata based on the controllerX?

/controller1/add/$itemdata

/controller2/add/$itemdata

/controller3/add/$itemdata

I want to send variable $controller (table) and $itemdata to do an insert into db table.

I have 40 tables and they willl all have similar inserts/updates based on the $itemdata but i do not want to copy/paste 40 functions for add/create.

Thanks

Regards,

Dennis

Try this:




'<controller><cn:\d+>/add/<itemdata:\w+>' => 'controllerX/add'



Using above url rules controller and action will be like this:




class controllerX extends CController {

  public function($itemdata) {

	//

	// PERFORM CRUD HERE

	//

  }

}