CodeIgniter Project with Cordova - php

I have developed a CodeIgniter app and now I would like to run it in native app using Cordova. As what I have found is that Cordova doesn't support running php script in html which is now a concern for me. May I know is there any other ways to solve this?

"As Cordova only uses static assets (HTML, CSS, JS) as main components to create a working app and doesn’t run server side scripts (.php) for example, simply you can create API endpoints for your website that return JSON data, then you can connect to these endpoints via AJAX calls from your JS file in the app so you get the JSON which you can parse it and print it to DOM."
Taken from https://www.quora.com/How-can-I-build-a-PhoneGap-Cordova-app-from-a-CodeIgniter-website-or-any-dynamic-website

Related

How to integrate and run php in existing vue app in the same local host?

I have build an app with vue (not with vue cli). I ran It on my local host. What I am trying to do is to add php in this Project. But I cannot run php and vue on the same local host together. Is there a way to solve this problem ?
I know when the app is created with command line interface you can compile them with webpack. But how to combine back-end and front-end together when the app is created with vue?
Thanks a lot in advance
Vue is a javascript framework and I suppose you are familiar with javascript. In javascript, we use AJAX to interact with PHP. we used to send POST and GET request to the server via ajax and javascript and we get the response from the server.
In a similar way, you need to learn how to create Rest API for GET and POST via vueJS and PHP.
You Need to create Rest API for VueJS and PHP. There is no other solution. follow the links below as per your need.
Here is the Github Link for the Same
You can also use Laravel framework with Vue

Parse: upload PHP files

I am new to using Parse and am developing an app using it as a backend. I want to also use it to develop a portal that would access data submitted from the mobile app.
Can I use Parse Cloud Code to upload my PHP files there (developed using PHP SDK)? Or should I upload it to another hosting provider and connect to Parse?
In the docs, it states I can use javascript library there but didn't catch anything about PHP SDK files uploaded and accessed from there.
Thanks,
No you can't, Cloud Code only supports JavaScript. If you want to use PHP for server-side logic (beforeSave triggers for example), look into using Webhooks which will hit an endpoint on a server specified by you (see https://www.parse.com/docs/js/guide#cloud-code-advanced-cloud-code-webhooks)
If you are looking into hosting some sort of frontend on Parse (for example an admin area) then your only option is JavaScript, see https://www.parse.com/docs/js/guide#hosting

Build webservice for both website and app

I've developed an android app that interact with my database by using some php scripts (one for each function of my app) that returns a json object with response data.
Now i need to build up a website too that do the same tasks of my app, but i would fix up my server code.
Should i have to maintain my app php scripts separate from website scripts (i'm planning to use some php framework to develop it), or there's a different way to do it?
No! Same script will work for all platforms.
If you follow proper protocols you will be good :)
Use Rest Console or similar tools to test your webservice on browser.
If you are able to get JSON response, then its good for all platform.
If you want to separate out the platforms and devices on server that can be handled by using user agent check at server end.

Php in phone gap application

We have to develop an application with more plattform. We would use the framework PhoneGap. For our application we need services of backend, the question is: Does PhoneGap support PHP?
If it doesn't support PHP. In which way we can solve the problem?
The most important thing is: make call server
(Get and Post), parsing a json and other functions
that PHP gives.
Phonegap does not have a server. You need to call via Ajax to remote servers.
The backend can be in any language which supports HTTP calls, as PhoneGap is an independent client.
You can use PHP to write an API for use within your Javascript PhoneGap application.
I can recommend the Laravel framework to accomplish this.
Yes...you can use PHP or any PHP framework to give backend for mobile app made using phonegap/cordova....point is phonegap/cordova app will be on client mobile which won't understand PHP embedded in phonegap html files....so write an API amd place it on a server and then make AJAX calls to server to do database and other backed operations
Try to return JSON data from the PHP API.....it's a famous data structure and supported by many applications

Opencart and phonegap

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.

Categories