I have created web application where I used CodeIgniter for secure form, also I have connect with remote MySQL database.
Now I want create mobile app in PhoneGap. I never used it before so I need to ask about a few things.
Can I create in PhoneGap php folder and there make PHP file to connect with my database?
How to secure form in my mobile app? Can I use CodeIgniter? If yes: how? Just paste CodeIgniter files to phonegap www folder?
I hear something about AngularJS. Can I use it for secure form? maybe CodeIgniter is not necessary?
Sorry for noob questions ;)
What you have created is called a Web App.
What you you would like to create with PhoneGap is a Hybrid App.?
PhoneGap/Cordova framework contains a Browser and has plugins that can be added to access Native features which can be accessed through JavaScript.
Native features of the phone like Contacts, Calendar, GeoLocation, Accelormeter etc. Which is not possible when you use a Mobile Browser. Hence the name Hybrid App
(Using the term Browser for simplicity sake. A more appropriate term is Webview container.)
So any web application that uses HTML5, CSS3 and JavaScript will work with PhoneGap/Cordova.
PhoneGap allows you to create Hybrid Apps for all the platforms Android/IOS (Iphone)/Windows/BlackBerry.
Now comming to your questions.
Q1)
You do not need to create any folder.
You just need to point the startup (index.html) file to your Webserver address.
Q2)
As informed earlier your Hybrid app is a like a Browser(with additional features) so the same codeigniter code for securing the form will work.
I hear something about AngularJS. Can I use it for secure form? maybe Codeigniter is not necessary?
Codeigniter is a Serverside scripting tool which is used for processing server side request.
AngularJS is a client side JavaScript framework which is used mostly to create a SPA ( Singe Page Application) web application.
SPA web application relies heavily on AJAX
EDIT 1:
In the index.html file which will be located in the assets\www directory you need to add the following code in the head tag.
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Codova API
window.location="http://your.website"; }
</script>
You also need to tell Cordova that it is safe to load your website in the config.xml properties (you can remove the subdomains part if you don't have any)
<access origin="http://your.website" subdomains="true"/>
Related
I am trying to make a single page web app that runs over a websocket for all server request. After the user logs in, I want the page to change the html to display a dashboard (first page).
I have a template for the dashboard already build from a previous version. I need to find a way to input database info into template and send the page over the websocket as a string for the javascript to display.
I don't know how to fill the template using php classes without hard coding it into the class, then turning it into a string so I can send it. The dashboard is very complex and has dynamically built menus for each users per their settings and permissions.
Am I looking at this whole problem wrong? I have some experience with MVC from ruby on rails/node.js, but unfortunately this app is stuck using php. Can I use a framework with the socket? Should I have the JS load the template through https and send the data over the socket? (The JS guy would not like that).
I am running Ubuntu, apache2, php7, Ratchet WebSocket(wss), composer, and MySQL all on AWS.
I would definitely let the frontend get the required data. You could use php as a backend to test the authentication, parse the request, get the data from the database and send it to the frontend. The frontend then would need to update the application using dom manipulation (think jQuery).
Or, php could send a generated view that would be shown in a div in the frontend.
In this setup, I would not recommend websockets, but just plain AJAX.
From what I gather from your question, you might be better of using a real SPA framework like AngularJS. It it just better in using the data you will get from the backend. You could then choose to use a PHP backend using AJAX or a Websocket backend like nodejs.
I have an iOS/Android app and I want to convert some of its functionality to webview, as this will make minor changes easier as I will only have to update the web app, rather than updating both iOS and Android and wait the review process.
I already have a PHP-mysql server app and use various server-client communication, so I am adding to this server app the pages I will display in my mobile app webview. The drawback here, is that if I typed the url and passed the same parameters in any browser, it will work, and I do not like that.
How to make sure inside my PHP code, that the page is being called from inside my own app?
Thanks for advance.
I want to make my web app (which is built with laravel) work offline...but I cant found out how to do it!
I am using the "app cache" for static files, but im not sure exactly how to handle the dynamic side of the app.
The app uses a database which im guessing I need to use localStorage for? (from what ive read online so far)
Im basically just looking for someone to point me in the right direction as im struggling to find much online on setting up Laravel for use offline
Thanks,
Dave
You can only have a static site offline with appcache. You cannot do this with laravel.
If you want to move the data into localstorage and have a semi- dynamic website, you have to completly change your architecture. Let me outline a possible approach :
A single page web app written in javascript ( using a framework like for instance ExtJs ) that connects to a backend in a form of a webservice that gives access to the database ( you could write it using laravel ).
When you are connected to the server you can load the data in localstorage When you are offline you can continue to work with the data. When the client reconnects, you have to synchronize the changes with the server.
Edit: As of 2020, Application Storage is deprecated. Look into ServiceWorkers instead.
I am developing a web application using PHP uploaded in my server. But since it requires a number of CSS and JS files, I wonder if i could store those files in the assets folder of the android application and access the files using the php/html page which is in my server. In short, I need the external css,js files to be in the application's asset folder and the php file in my server and I need them to be displayed using webview.
If this is not possible, can anyone tell me a better way to use PHP web application in android? I am using HTML5, css3, jQuery mobile and PHP, MySQL. I am good with web designing compared to application UI design, so I am going for the HTML5 way.
I am new in PhoneGap,
I have a Joomla Site, I want to create a PhoneGap App using that Joomla site. so is this possible ? if yes than how can i implement it ?.
You can use. But you have to create web services for request and responses. Because Phonegap will not run PHP script. So you can create webservices to access Joomla functionality via JSON responses from your joomla. You can get the JSON data via jQuery in your phonegap app.
and someone said PGBuild will convert webpage into phonegap app. You can try it also.
I have succeeded creating an application as follows:
Design your Joomla page so it's responsive and renders correctly on your mobile;
Download the whole thing with wget
Edit all urls and make them point to the right (local-remote) locations.
I saved all css, images, js locally so the page would load even offline; then changed all the links so they point to the remote host;
All forms should point to the remote host;
Most modules and components were changed so after the initial display (local) they will load the updated info in the frame.
Popups won't be available, so you'll need heavy workarounds for facebook integration etc.
Also, if you plan to use any phonegap features, they will only be available if you load the library inside your downloaded page; this will force you to change all calls to ajax (no document.location.href calls are possible since you'll lose the phonegap javascript).
The first time you load the page from the server it will take forever to load. Ensure you have proper caching set up otherwise you'll just lose your customers.
My advice is to start with an ajax project at the very beginning, it will save you lots of headaches.
Keep in mind, if you plan to use iframes, forget it. They work lousily on iphones, and debugging is nearly impossible. Simply take your time to plan a real phone app in javascript & using Ajax for the calls.
You don't need any webservices in Joomla for loading content, simply use:
&tmpl=component
when you need the content of a module.
Additionally, for blogs and lists, Joomla makes RSS feeds available so you shouldn't need too much coding to achieve this.
I have limited myself to ajaxifying the modules, which makes caching more efficient on the server and the interfaces appear more dynamic.