how to change 'item' on Phil Sturgeon’s RESTful API |
[eluser]huuray[/eluser]
− <xml> − <item> <userid>1</userid> <username>example</username> <useremail>[email protected]</useremail> </item> </xml> hi all,im new to CI,just want to know how to change <item> to something else.maybe <user> the array from database. thanks
[eluser]Stockhausen[/eluser]
Hi, Near 408 on the REST_controller.php, add a param $rootxml and change inside the private function near 431 Code: $key = "item"; by Code: $key = $rootxml; Do the same action to private function _format_rawxml Code: // Format XML for output
[eluser]Stockhausen[/eluser]
Exact do this way, maybe the only method Near 87, we change the response method : Code: function response($data = array(), $http_code = 200, $xmlroot = 'item') Near 408 on the REST_controller.php, add a param $rootxml and change inside the private function near 431 Code: $key = "item"; by Code: $key = $rootxml; Do the same action to private function _format_rawxml Code: // Format XML for output and when you call your response in your controller do this syntax : Code: $this->response($user, 200,'user') Probably not the best way. but it's work fine.
[eluser]Stockhausen[/eluser]
You're welcome so please pût thés topic with the résolve status. |
Welcome Guest, Not a member yet? Register Sign In |