I am working on a Android Application that has web view where i need to load html, jquery and js and php also. Now i am able to load html jquery css javascript , But my problem is i am unable to load php in web view in offline is there any way to execute php in web view
Please Help Me Thanks In Advance
You almost certainly don't want to run PHP on your Android. But in case you do, then you would want http://code.google.com/p/php-for-android/. Better link: http://phpforandroid.net/
PHP is a server side language. It cannot run inside the browser. It helps you to build the dynamic web pages.
You can call any web page in the webview when you are online. it doesn't matter what is the server side language.
When you are offline, you cannot send request to any server. so no question of executing any page.
You can do it easyly with AndroPhp, just search it in Google play and install.
Its like WampServer for Php+Mysql. You should run it than just create your PHP project under www/ folder and call it from Android webview 127.0.0.1:80/yourproject
This way you you have local server on your Android, you shouldnt code in Java for Android all you can code in PHP. Maybe it is not a elegant way to code for Android but works !!
Related
I made an app using jquery mobile, php and mysql and now I'm trying to convert into .apk file using phonegap for desktop.
But I have a problem with my php code because it doesn't work, phonegap doesn't recognize php code.
Is there a way can do it to convert both jquery mobile code and php & mysql into .apk?
I will post the whole code if it's necessarily or another way to do this, please help!
Unfortunately not.
You would have to separate your server-side and client-side code.
HTML & jQuery Mobile would be your client, which you could turn into your app.
PHP & mySQL would be your server, which you could not put in your app.
You would then communicate between the client and the server by calling Ajax in client code, you might also like to use a framework like CakePHP on the server.
Good luck!!
I created an app using PHP and it runs fine using the HTTP address in the Webview object.
When using locally, the PHP script does not work (putting all files in assets).
Is there a way for PHP pages to be loaded locally but to define the actual PHP part to be used at the webserver?
To clarify, all HTML content of the .php page will be used locally but when needed PHP code it will connect the webserver.
Thanks!
If you use a php content you should have Internet connection because php codes work on server side not local devices(some apk's install mysql+php in your android device but if you want to publish your apk this way wont work in all devices on local.)
Also if you want to make an offline project why dont you use javascript "To clarify, all HTML content of the .php page will be used locally"
Here you can download phpforandroid.apk to work on the local Click Here
I am new to Twitter Bootstrap and I included some simple PHP script to test and my browser (Chrome) won't read the php code. I have saved the file .html, .php, and tried .html.php. Is it that Twitter Bootstrap only works with client side, not server side apps, or is there a trick to get it to work with PHP?
Thanks
Does Twitter Bootstrap work with PHP?
Yes and no.
Bootstrap is entirely client side. It can be output by PHP (just like any other client side code) but has no special features for interacting with it.
my browser (Chrome) won't read the php code
PHP is a server side language. No browser parses PHP code. You need to access it through a web server that will execute the PHP and return the output to the browser. See also installing PHP.
Bootstrap is just some css and javascript. You can use it with a PHP app just fine. We do.
Use Microsoft WebMatrix 3 (installing php and Wamp servers is really very annoying)
Use Webmatrix IDE and then php and bootstrap will work just fine..
For javascript and html files only, Dreamweaver's build app for android function seems to work great in cs 5.5. But when any php code is put in (for authentication, or for ajaxing in web service returns ) it seems that the android app just displays broken php code instead of executing it. When building the app, Dreamweaver won't even let you use a root php file in the project; it only seems to only accept html files.
Am I doing something wrong? Building apps out of web language-based files seems a lot less useful if server-side code isn't allowed.
Are there any other alternatives? Titanium studio looks really complicated, but I'm willing to read the docs if it's worth the time.
http://help.adobe.com/en_US/dreamweaver/cs/using/WSeffff8bffc80208478c8d43312e240fe0ad-8000.html
Indeed it only packages HTML, CSS and Javascript into an Android or iOS package.
I'm afraid you'll have to learn real Android development if you want something more complex.
Dreamweaver will package the files up just like you asked, however, the destination system is what runs the code. Android doesn't execute the PHP within the app. Your app has to connect with a remote server that is to handle the log in. Thinks of two separate apps, one on the phone and one on your server.
Android doesn't execute the PHP within the app. This is because PHP is a server side client and Not client side. Unless they create some inbuit servers within phones from which native apps can tap into. One option you can use is to use html files and within them, create links to php files which are in online servers so as to have your scripts executed.
Is this possible??
If i wanted to put a UIWebview into my app, could i make mysql db calls and use other PHP functions?
You can tell your UIWebView to load a URL of a file sitting on a web server. That URL can be to a PHP page that can do... well, anything a PHP page can do. Database stuff, etc.
But that's happening on the SERVER. PHP is a SERVER-based technology. PHP doesn't run on the BROWSER, which is what a UIWebView is.
No. Think of the UIWebView as a web browser, as opposed to a web server. It is effectively a way of embedding Mobile Safari into your application.