PHP & Mobile Sites - php

I'm just about to start a small mobile site that will be written in PHP. I am aware of the design principles of developing for mobiles, my question is more to do with the compatability of PHP on mobile devices. It is:
If I use PHP to make this mobile site (which will render in the client's mobile browser as good old HTML) will I run into any compatability problems?
As far as I can see, because PHP is a server side language, as long as it serves mobile friendly HTML, I should be able to do everything I please in PHP in my scripts? Is this correct? Or will iPhones, Android Mobiles and various Fondle Slabs refuse to render a xxx.php file?

You're right that it's a server-side technology. The browsers (whether mobile or desktop) will not care that it's PHP as it will never see anything but the html/js that is rendered from your PHP scripts.

As you mentioned PHP is server side language, so there is no way it could possibly be cause of compatibility issues.

PHP is a scripting language that dynamically generates HTML.
So instead of creating a website from lots of static HTML files, a dynamic website generates the HTML when required - each time a user browses to a page the PHP is run on the server to create the HTML that is shown in the browser.
To answer your question, it is not the PHP that determines how sites look on mobile devices, more the HTML it generates :)

You are correct. You could use haskell (as long as it renders html) and still make it show on a mobile device.

Related

Take screen shoot of client windows using php script

Is this possible to take screenshots of windows's screen of client users using a PHP application?
If you want to capture the current client web page, you should look into JS solutions (see this related SO answer):
html2canvas
npm packages with keyword ‘screenshot’
You may also be able to programatically load and render HTML with a GET request, though you will still need to run JavaScript to render the full web page on the server side.
If you mean a screenshot of the actual desktop, I fear only the browser would be able to do it and this is still at an experimental stage, probably due to security concerns:
Chrome desktopCapture extension
MDN Media Capture and Streams API
Can I use media capture?
Edit: Possible duplicate of this question. Some back-end libraries to render a web page:
dompdf (PHP5)
wkhtmltopdf (C++)

Database record wont show on my mobile application

I use html5 + css3 + jquery mobile to built my mobile application. Actually I've already desktop version, and i want to make mobile application.
Is that true php wont work on html5 for mobile application?
If that true, i use ajax for call my JSON (that place create on jsontext.php).
I tried HTML5 on desktop browser and it worked.
I built it to apk using build.phonegap.com and install the apk to my device.
After that, my database record not showing. Maybe it didn't execute.
Other user in stackoverflow said we can use backbone.js. how-to-access-a-remote-database-from-jquery-mobile-application
are my steps right? or I have to use backbone.js. THX.
Here's some answers:
Yes, php won't work in a mobile native/hibrid mobile application,
because php needs to be interpreted by a php server before
generating output.
Its easy and simple to both generate and parse JSON, it's widely
used in apps.
That is good. If you want an 'online-only' kind of app, you can use
a webview and point it the url of your app - its basically a browser
without navigation buttons and user interface - but something's
don't work that well, you should test before. It may also display
your app as sluggish and unpolished.
No problem with that, Cordova/Phonegap is actually becoming a very
good mobile framework. You should also install ADB
(http://developer.android.com/tools/help/adb.html), ADT
(http://developer.android.com/tools/help/adt.html) and the Android
device emulator
(http://developer.android.com/tools/help/emulator.html).
You must be sure on how to insert and retrieve dabatase records.
This depends on how you programmed it. Be sure to have the database
available publicly (accessible only from the apps, though).
Hope I've answered your questions, and that it helped.

can I use an iframe to load a php website on ruby on rails framework?

I have a client who wishes to use our website as a plugin on his website. His website is being developed in Ruby on Rails. While our website is a PHP website. I was considering using iframes to load my website inside theirs. However I am unsure if this is possible as I have no clue about the Ruby framework.
Please help.
Thanks in advance.
Yes, you can. The HTML that is served to web browsers is independent of the web framework used on the server side. A browser will not be able to distinguish HTML generated by a PHP/Python/Rails web application if the generated HTML is same. For browsers, it's just HTML which it'll parse and display content accordingly.
In your client's Ruby on Rails site, you can have an iframe embedded like this
<iframe src="http://www.yourphpsite.com/php_page.php"></iframe>
Iframes are independent from the framework you are using since they are purely HTML and can show any page that the visitor have access to. It might not be the most elegant solution, but it will work fine.
Iframes are browser-side HTML elements and can include anything that can be pointed to by a URL, so yes. You can include a PHP website on a Rails website or a .NET site or a Java Site or a Python site or a whatever. Please understand the over all topology/landscape of what runs where and what exists where.

how to convert php existing web application to mobile application

i have developed a webpage with joomla 1.5, now i need to convert my web application to mobile application. the user can download my application through mobile apple or etc then they can access. Tell any tips and kindly guide me...
You could take a look at phonegap ( http://phonegap.com/ )
It is a java framework that you can control with javascript to ring, vibrate, determine position, etc.
There are tutorials for how to make an application for every phone operating system, and they are pretty understandable for beginners. However, since you use joomla, your code has to run on a php server. (The tutorial covers only how to embed local html files in your app).
There are some tutorials out there that cover the use of phonegap with 'existing' websites. Google for it.
In the future, you might want to have a look at jquery mobile, there is an interface builder on their site http://jquerymobile.com/ and it is designed to look good on every device. You can use their themeroller and some additional css to achieve quite a nice app.
Suresh, because it will be important that your users interact with your server where your Joomla installation is hosted, it will be most feasible for you to create separate CSS stylings for your website that will be mobile specific.
Because Joomla has a user community, it is likely that plugins or templates have been written that can help speed this process up. Here's an extension that accomplishes some of what you're looking for, in-so-far as it will allow users on mobile phones to interact with your website via a browser in a comfortable way.
http://extensions.joomla.org/extensions/mobile/mobile-display/11722
Have you tried Mobile Joomla? It's a great extension that would be an easy first step to getting your site mobile-friendly.
"Mobile Joomla!® is the best way to mobilize your Joomla! site, displaying beautifully on iPhone, iPad, Android, Windows Phone and all other phones."
http://www.mobilejoomla.com/
for converting the existing web application to mobile application,you have to create web services of the web application and return the data in XML or json format.at the end of mobile development like on android plateform you have to parse those data on simulator,and this way you can test the application and use in mobile.
Humm joomla is not a good bet for mobile web apps. Even with adapted css and layouts, If you have a lot of extensions, some might break in mobile view.
I would build a a web app from scratch (using jquery mobile, that as a good cross platform support) and get the data from the original website. It might take a while longer, but the experience for your users will surely be better.
EDIT:
From what I gathered from your comments, it seems you want a landing page where people can download a "game" to their mobile phones, is that right? Please explain exactly what you want to accomplish so we might help you.

Embedding a web based game into an Android Application

I've created a simple web based game (text driven) in PHP and have recently become very interested in moving this onto Android - originally i thought the game could be rewritten in Java but after some investigation i found you can embed pages straight into an Android application.
Am i missing something or will i be able to simply embed my web application into Android and expect it to work flawlessly? Is there any issues i should be aware of? My app uses a login system utilising sessions / cookies - will this pose a problem for Android users?
I'd be interested in hearing anyones thoughts that have done something similar and any issues they've encountered. The only issue i forsee is how the page renders on different phones (although this i imagine this can be somewhat nullified by good markup and well thought out javascript) and any issues in regards to sessions / cookies?
If anyone has any good resources for doing this sort of work i'd be grateful.
As a final thought it'd be good to hear peoples thoughts on whether i should rewrite it or keep it embedded, what are the benefits of rewriting it?
Thanks
The WebView class provides access to a full fledged webkit browser. As a matter of fact, the default Android Browser itself is implemented using that very same WebView implementation. Javascript, Sessions and Cookies should be no problem whatsoever, you probably just have to activate them (see WebSettings).
Even flash should more or less work on newer devices, but I don't have any experience with that.
See http://developer.android.com/reference/android/webkit/WebView.html for further details.
Generally, using Apps as so called "launchers", i.e. apps that basically only contain a browser window are somewhat frowned upon, since the android market isn't meant to replicate the world wide web. I do somewhat understand the need for that though, since visibility is much higher and Google does not yet provide a way to treat web apps as first class citizens, like they do for Chrome OS.
On the other hand, if your app already works fine using php, I don't see any need to rewrite it in native code.
Take a look at http://phpforandroid.net/

Categories