I am going to work on a website having features like pinterest.com, simultaneously I will have to develop API for android and iPhone apps, I am planning to develop this website in CakePhp, my question is how can I develop website and API using same models and controller, i.e. only the view layer will change in case of website it will be html and in case of API it will be json. Is is possible to do this efficiently, and what coding pattern should I follow, please give me any open source examples of code.
this link gives me some information but detailed instructions will be helpful :)