Opencart and phonegap - php

Hi I have recently began to build mobile open cart sites for mobile browsers. I would like to take it a step further and build native apps using phonegap. My question is , does phonegap support a structure like opencart? Are php files supported?
Would it be possible for me to build a fully functioning opencart site and integrate it successfully with phonegap?
There is very little information online regarding this question.

A Phonegap app cannot contain any server side scripting like PHP. It can only contains HTML, css and Javascript.
But you can always do request to a remote server that runs PHP.

Opencart has quite a few ajax interfaces in various parts of the app. These call controllers that deliver sections of a page usually. I have not looked into the full remote API to know if you can build a full shop app that uses the opencart backend.
If you look down that ajax calls path you may find enough functionality to produce the phonegap app.

Related

convert web application to android and ios application

I designed and programmed web application like the website but has more processing in the admin page...
after that the customers ask me to convert it to the application , So, can I convert it traditional by any online website to application converter which takes the link of the website and converts it to .apk
are this method is correct?? or it has a bad effect in futures when the number of users is increased???
Note:- the web program or site that I build it is programmed in PHP in backend and HTML, CSS, javascript and bootstrap in front end
can anyone help and advise me pLz???
There is no such thing as website to apk converter unfortunately.
You have to build the android application separately.
You can use your PHP models with CURL to call as API from Android.
This article can help:
click
or
You can build Android app only containing webviews and you can call each webpage in different webviews.
Click here for help for working with webviews in android.

Can PHP be used in Android app development?

I've got a book I bought online - O'Reilly's Building Android Apps with HTML, CSS and JavaScript. The idea is that you can use these 3 to create a website that can be converted to an Android app by using a Java conversion tool.
Hopefully someone will be familiar with this, and hopefully this is possible - if I have a website that is already created that also includes PHP, could this be used for the app?
I've created PHP sites before, and the one I'm specifically looking at is referencing a MySQL database, hence my need to use PHP for the app. The website is heavily based on PHP.
No you can't (Unless you created your own framework which runs a local php server inside of the device which can be accessed by a webview). Php is a server side language. Html and JavaScript are client side. These html app creation frameworks use the webview to run apps. Be careful as there are performance issues when running through webview as it is not a native app (projects like crosswalk help but still many issues). Popular frameworks include ionic (Angularjs), titanium (is mostly native but from my experience limiting), and appgyver (Angularjs).
Yes you can! If by "converting" the website to app you mean displaying the website in a chromeless view mode (without address bar).
If you wan't to use phonegap / cordova you can still use the existing PHP code as backend for the database (Maybe rewrite it into a Restful API).
If you want your app to run natively and without internet connection, then you are out of luck though.

Creating an Android app using PHP

I'm going to create an Android app for the first time, and I wanted to do it in PHP, I've done some research and found the likes of PhoneGap, but I'm still quite short in the area, could someone give me a start?
What I'm going to be doing is a simple app for testing, a shop where you search for products, add them to your cart and check out, and the names of the products you ordered will be entered to a database.
Basically;
Search for products->add to cart->check out->info sent to database (all through PHP).
Where should I start?
Cordova is mainly a JavaScript framework that exposes native device features as JavaScript functions. Think of a cordova application like a plain HTML & Javascript website running in a Webview within your mobile application. The PHP interpreter isn't available on a mobile device, which is why you cannot package PHP files into a cordova app and expect it to work.
You could however write your backend in PHP and use XMLHTTP calls (in JavaScript) to retrieve data and present it to the user.
Additionally you can use any JavaScript framework in combination with Cordova so if you are familiar with any of them (like jQuery, Knockout or Angular) that would be an advantage. I'd suggest starting with a Cordova tutorial, like for example this one: https://ccoenraets.github.io/cordova-tutorial/index.html
Another project that is getting alot of attention lately is the Ionic project, which is also based on Cordova. I'd think based on your requirements this would be a great framework to use: http://ionicframework.com/

CodeIgniter website + phonegap practice

I have already developed website using codeigniter and it's now in testing phase and as business requirement we need to have a small version with limited feature as mobile app Iphone, Android...etc
I have done small research and i found that one the best practices so far is using RESTFUL webservice in codeigniter so i wont rewrite the code i just add API that handle request from PhoneGAP app
but I mnot sure how i will be able to communicate from phonegap , is it JAVASCRIPT like Node.js or what kind of code supported in PhoneGAP,
Thank you for your suggestions
You can make AJAX requests in PhoneGap in a similar manner like you would in a browser application. I haven't worked with node.js in any respect so I can't comment on that specific library but I have used both jQuery and Dojo to perform AJAX requests. You will just want to make sure your application has asked for the proper permissions to make network requests to your domain. Have a look at this for setting up those permissions.
http://docs.phonegap.com/en/2.2.0/guide_whitelist_index.md.html#Domain%20Whitelist%20Guide

I want to create a mobile website in addition to native apps using phonegap. Is it sensible to use the same codebase?

I want to have a mobile-friendly website, in addition to a native app for iphone/android using phonegap. I'm currently using PHP (specifically CodeIgniter but that's not as important) and jQuery for the mobile website.
I'm thinking that the website and the phonegap codebase can use the same PHP back-end for server requests but the front-end must be somewhat different since phonegap has proprietary javascript to access native functionality (camera, accelerometer, etc) that a browser couldn't access. For this reason, I think the front-end must be developed separately for the mobile site vs. for phonegap.
Does this make sense? Am I missing something that would allow me to use the same phonegap codebase as the mobile site?
Where I work, we developed our mobile website and Android App with the same codebase except for the views and UI. Everything on the web side is in pure JS and HTML. We have a sever side API that we request data from and then template it using Mustache.
We used Titanium for the Android App, but found that framework to have more cons than pros to use. So for the iPhone app upgrade we're using PhoneGap. It took us a few hours but the mobile site ported over exactly the way it works in browser, to the native iPhone app created by PhoneGap. In short, It's absolutely possible but you have to develop the site in JS, all the logic, to have it port over easily to PhoneGap.
Also, just a recommendation, you should try using Zepto.js instead of jQuery. It's aerogel weight, has the majority of jQuery functionality without all the IE bull and it uses the familiar $ symbol as a namespace. Much more suitable for mobile development.
Specifically, PhoneGap has plugins that you write. There's two sides to this, one JS file which will match the plugin that you write for the native Obj C or Android file. The plugins are modular, so you can plug them in for the native apps and out for the site.

Categories