Convert a PHP website to an Android App - php

This question may seem off-leading but I want to convert my website in to an actual android app. There were suggestions that I should just create a custom-web browser and that the address will then lead to my website which of course looks like the app is the website itself, but what if I'd like to "convert" like code-for-code in to android's IDE? Is this possible?
Because when I stick to the "browser" method, sometimes, since it has to load the HTML, CSS, JS and etc. I'd like to make it "rooted" to the Android app like it's already there so that when it connects to the internet, it will only get my MSQL data and skip the whole HTML, CSS, ... loading stuffs everytime they visit my page.
Is there any way to achieve something like this?

You can try at webview. It is a View that displays web pages. This class is the basis upon which you can roll your own web browser or simply display some online content within your Activity. It uses the WebKit rendering engine to display web pages and includes methods to navigate forward and backward through a history, zoom in and out, perform text searches and more.
You can explore from the following link:
https://developer.android.com/reference/android/webkit/WebView.html

The simplest way is to use ionic/cordova to create a webview that will browse the live website on the app load. Alternatively you can use online service such as applika.me that does more of the same.

Related

Display a view in the mobile app, from the website (knowing if user comes from application)

Let's see if I can explain this and make sense at the same time...
I've a website and a mobile app for that website. In some cases I'll use the view on the website in the app. I wont redirect the user to the website, but the website view will display in the application. But in this view I'll also make some changes. Lika media queries but at the same time not, because it the user is using a mobile but not the app, a the website will show as normal, but responsive of course.
UPDATE (trying to explain a bit better)
If you use the mobile app, only a specific part of the website will be shown. In this case it will be product categories. Header, footer and all the other content will be gone except for the product categories. If you use the mobile and for example safari, the header, footer and all that stuff will be shown.
So the question here is how can I check, with using PHP, if the user is coming from a mobile app and thereafter display a certain view?
You could have the mobile application open up the website with a GET variable set. Example would be the mobile app would open up www.myWebsite.com?source=mobile.
This way when the php is run on the page you can have something like:
if ((isset($_GET['source'])) && ($_GET['source'] == 'mobile'))
{
//This is a mobile view!
}
A downfall to this would be that anyone could just type ?source=mobile to trick the browser into thinking it's coming from the app.
If you use third party mobile application you can try figure out the source of the request by HTTP User-Agent. Usually issues about views solving by CSS with #media rules.
I hope I got your problem.
You can check by user agents. Using _SERVER['HTTP_USER_AGENT'];
Or else you can use 3rd party libraries like
http://mobiledetect.net or you can use bootstrap library for do that.
If you want to do different design for mobile and desktop then I prefer to you to use bootstrap library.

How to create unchangeable part of html even though the browser's current urls changed?

I have searched about that for very long time. But I havn't known how it works and how to create it. I am so serious to get it. I am a beginner of Ajax and JQuery. I wish to create a fixed mp3 music player in my web. Although I have some code and know how to do mp3 player for html5, but I have not knew how to do fixed mp3 player which won't change playing when another pages load. Could you help me, please. Example: it is like of www.revernation.com and facebook's chat popup box, still active without refreshing another pages.
You can't keep an mp3 player running when the user navigates to a completely different site in the same browser window.
You can however keep the current page open and fake navigation to other subpages of your own site with History API + AJAX and DOM manipulation. The trick is sometimes called pjax.
An example implementation: https://github.com/defunkt/jquery-pjax
Angular.js does what is described in the previous answer.
What you need to do is convert your app into an SPA.
Single-Page Applications (SPAs) are Web apps that load a single HTML
page and dynamically update that page as the user interacts with the
app. SPAs use AJAX and HTML5 to create fluid and responsive Web apps,
without constant page reloads. However, this means much of the work
happens on the client side, in JavaScript.
Best for SPA
i suggest you to go with AngularJS.
You can still do it with JQuery with Ajax calls if you don't want to use other front-end frameworks

Convert websites into mobile website format

I would like to display other we pages in my mobile webapp, but some web pages will be too cumbersome for use on a tiny mobile device screen. So implement some kind of google mobilizer feature. Is there any API available in PHP so that i can use that to convert these pages into mobile compatible
No. You'll have to do it manually. You should look into responsive CSS layouts. These will adjust the content of the page as the width of the browser changes. So same page will work in a full browser window and mobile.
Look at
http://www.columnal.com/
http://lessframework.com/
http://speckyboy.com/2011/11/17/15-responsive-css-frameworks-worth-considering/
I got it, we can use skweezer API for this. If you want to see your website in mobile compatible format try this
http://www.skweezer.com/s.aspx?q=www.example.com
Replace www.example.com with your website URL.
For more details, visit http://company.skweezer.com/

Social Network & Dynamic vs Static pages. Where to draw the line?

As I come to the end of my project I am starting to wonder if I made it too dynamic. I have designed this social networking site and 90% of it is based on JQuery. It looks nice, it loads fast but I started to wonder if it is too dynamic...
My concern is that basically once you log in, 95% of what you do is JQuery based therefore the user never leaves the same URL. If this is true, how is a search engine like Google supposed to index my website?
Is this the part where I ask myself what parts of the site I want to be indexed and make them static pages instead?
Basically it has occurred to me that if when you browse my site for user profiles, these profiles are displayed to you through JQuery requests, then it is safe to assume that these profiles can never be found in a Google search, because the Google spider would never see it. Is this true?
Thank you for any thoughts on this,
Vini
Make your site work in both "modes". For example, I'm on my dashboard and I want to check out my friend Joe's profile, there should just be an A tag with the href set to something like "/profiles/joe".
Now, onDomReady, when the page loads, run your javascript to go through the links and attach click handers to those links, and load the profile dynamically using your existing jQuery style.
This development style is called "progressive enhancement" and allows both search engines and human accessibility devices to work better with your website. Check it out.

embedding a php webpage inside a webpage like vanilla forums embed plugin

I am creating this website (php app). Let's call it Site1 (so ingenious, I know).
I want other people to be able to "embed" my site into their site/their webpages. Something similar to Vanilla embed plugin
For example, if you wanted to embed Vanilla forum into your webpage, all you need to do is: copy and paste this forum embed code into the remote application where you would like the forum to appear.
<script type="text/javascript" src="http://embed.vanillaforums.com/plugins/embedvanilla/remote.js"></script>
If you insert that code, the forums would appear in your webpage.
I want other people to be able to embed my app into their page as well. I am not sure how to code my site in a way that it can be done.
To put things in context:
My php app is going to be a "classified-directory" app. It will list out some classifieds based on user's location. So, when user embeds my app into their page, we also need to make sure they have a way of passing "correct" location so that my app (embedded inside their webpage) shows correct classified listings.
Thanks
The actual build of your remote site has little in this case to do with embedding on another's website. The real key to your solution is inside of http://embed.vanillaforums.com/plugins/embedvanilla/remote.js. I'm not going to tell you how to go about it (leave that bit up to you), but the above script essentially creates and formats an iFrame on the user's page containing the remote application. Study the script and you'll figure it out.

Categories