views:

200

answers:

2

I want to build a phone app using phonegap that can access data on a mysql server that is backing a cakephp app. Can this be done, if yes then how can use phonegap to access data from a mysql server?

A: 

Yes you can!

You need too make the controllers of you cakephp to output views that can be interpreted by the javascript in your phonegap app. For a more detailed answer we need more information. i.e. what javascript framework do you want to use in the phonegap app?

jigfox
Lets say I'm making a content management system with cakephp. There would be authentication, different group levels, and all the other stuff that goes along with CMS. Also, I thought phonegap didn't support php, since it is only client side technologies. I know you said I have to interpret the the views with my phonegap javascript, but how can even have a view in the first place if I can get php in the app?Sorry if I'm not making too much sense. I appreciate your help and response. Thanks :)
amirrustam
That's right, you can't use PHP in PhoneGap, but you can use PHP as Backend on the internet. In Phonegap you can only use javascript, html and css. But Javascript can access a php page running on the internet.
jigfox
A: 

Just to be aware, an app that is basically a web page will probably be rejected by Apple. Quoting from the Phonegap Faq:

Q. Can I just create an iPhone PhoneGap-based app that just loads my website?

A. You can, but as for Apple approving it, that's another matter, and they most likely won't. As a rule of thumb, if there is no Internet connection, you must at least load the UI (your views) without the corresponding data, and put an error notice to that effect. Therefore your app must have these views included in it. For a guideline, set your iPhone to Airplane Mode in the Settings, then load either the Maps, Weather, Youtube, ITunes or Facebook apps, and see what they do (have a "shell"). Apple is probably concerned about them approving your app based on your app description and functionality as promised by you, and then you turning around and changing it completely after approval to something undesirable.

Also see similar question: iPhone Phonegap based app load External website made of componentone

Kris Erickson