Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 6    Views: 1125

Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
08/27/14 12:07 PM (10 years ago)

Can I run .PHP files with Xcode and Eclipse?

I've but an app using JQuery mobile and .php and wanted to add the .php files to my Xcode app project but I can't get Xcode to read the .php files. Is this possible or am I wasting my time? Any help welcome.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
08/27/14 01:48 PM (10 years ago)
The way you described it, yes, you are wasting your time.
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
08/27/14 02:05 PM (10 years ago)
Ha ha! Your too funny! So is that a no then? I've been told that if I use I think XMLHTTPREQUEST or WEB SOCKET, apparently this is a good alternative to allow Xcode to communicate with .php files. Do you know anything about this?
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
08/27/14 03:31 PM (10 years ago)
>Do you know anything about this? Yes I do. You cannot run PHP from Xcode, but you can access PHP code from Xcode or from any other language that supports HTTP requests. In more detail: 1) There is a server (just any Internet server that you have access to) and it contains code that can be executed through a HTTP request. The code executed can be in PHP, Java, Perl, whatever have you. In case of Buzztouch, if you are self hosted, all the code there will be in PHP and your BT app will access its server many times during app execution. Even if you never write any explicit request for data from the server, a BT app will access it without ever letting you know explicitly. The ability to communicate with the server is the main strength and advantage of Buzztouch over other "app making" sites. The PHP on the server can run because the server contains the so called PHP intepreter, software that translates PHP source statements into the code that the operating system is running on. In majority of cases, it will be a Linux host with Apache server; PHP is one module of the entire Appache server. 2) On Mac, you develop your app in Xcode and there is no PHP at all. You can install PHP interpreter on that Mac but Xcode has nothing to do with it. You cannot run PHP from Xcode (at least, not right out of the box). 3) Your app, after it is written in Objective C or Swift or C++, is compiled into the native code of the processr and once again there is no need for PHP. However, you can use statements in these languages to access URL addresses anywhere on the Internet; if behind that address is PHP code, well, you finally do what you wanted in the first place, access data from the server dynamically. You cannot "add the .php files to my Xcode app project" because there is no PHP software neither on the Mac that you are developing on, nor on the target machine, an iOS mobile device. What you can do is access URL addresses from your compiled app, using the statements you already mentioned, XMLHTTPREQUEST or WEB SOCKET etc. On a practical note, try to use as many features found in the BT framework instead of taking raw source code from the web. David Book has done most of the work for us so have a look at class such as BT_Downloader from BT_Core before starting to write your own original code.
 
Calypso Kid
Aspiring developer
Profile
Posts: 780
Reg: Mar 09, 2012
Upstate New Yor...
18,200
like
08/28/14 09:40 AM (10 years ago)
Nice explanation Dusko. Thanks Dave
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
08/28/14 10:21 AM (10 years ago)
Wow! Dusko That was pretty full on, but I get most of what you are saying. The reason why I wanted to know this question is, I built a self build mobile site and app page builder platform which I developed to use long side BT as I was growing frustrated with not being able to create an Android app equally as good as iOS and wanted to make both apps the same. So things like an image gallery or audio player that will work on both platforms. I also created a download source code feature to allow me to take files into BT but I soon realised that I cannot update static html pages. Problem I have is I could just use the Custom URL plugin as my platform creates a unique URL which I can take into BT but I found the delivery over 3G a bit slow and thought that I can add the JQuery mobile files and php files directly into Xcode etc and compile. Some of my widgets are dynamic and are built using php. All I wanted to do was provide a solution that would allow me to build apps faster and across any platform and take into BT to rap in either an iOS or Android framework. I guess I have a lot of thinking to do still, but you post has really helped.
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
08/28/14 10:50 AM (10 years ago)
>Nice explanation Dusko. Thanks >but you post has really helped. You are welcome.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.