I have one trouble in routing in CakePHP. I have index action of all customers. And the question is, is there a way to make it this way, when I go to /..../.../customers
CakePhp renders index(as per default), but when I am going to /..../.../customers.json
(in .json format), CakePhp renders another action, where some array is serialized. I already enabled mapping resources, so it works just fine without overriding, but is there some way I can implement this ?
I've already read https://book.cakephp.org/2.0/en/development/rest.html.
Thank you, Gransfall. I just check if the request is json and then load the view in the need way.
if(isset($this->request->params['ext'])){
if($this->request->params['ext']=='json'){
//here setting serialized array
}
}