PHP Developers Network

Best way to design site that will be viewed web/mobile/app/+
Page 1 of 1

Author: [ Wed Mar 16, 2016 12:45 am ]
Post subject:  Best way to design site that will be viewed web/mobile/app/+

Hello all,

I'm about to embark on a new project that will have be a regular website. However, it will also have a mobile website, a mobile app, and a desktop application. The mobile app and desktop applications I'm thinking will likely just contain a blank file that will grab the mobile website and display it via ajax.

Here's how I'm thinking about doing this.

Design the normal website in a place like follows: (public_html/web/)

And then, the other versions will reside in respective locations: (public_html/mobileweb/) (public_html/mobileapp/) (public_html/desktopapp/)

Basically, the full version will be in the /web/ directory. The other versions will only have files specific to those versions. For example, the mobile version will definitely have a few different templates. The main page will check if there's a mobile version of a file to serve, and if not, include the web version.

So basically I'm just doing the whole thing in /web/ and only putting files that are different in the other directories and checking for it on page load.

Is this the best way to go about this? Would another way be better? What other way? Perhaps just make an API (though, then I'd have to make 4 separate versions?). Thoughts? Ideas?

Author:  requinix [ Wed Mar 16, 2016 8:40 am ]
Post subject:  Re: Best way to design site that will be viewed web/mobile/a

What are the differences between the four versions? Normally it's just in the display of particular pages, and if that's the case here then I would probably use five folders: one with the code, four with the "views" for each page. Like public_html/code/index.php serves as the code backing the homepage, does what it needs to do, and uses public_html/{desktopweb,mobileweb,desktopapp,mobileapp}/index.php for display.
Actually that suggests a sixth folder for the "framework" code. For the most part that is what runs first, it decides to invoke the code/index.php controller, then passes any data to the correct view.

Author:  Christopher [ Wed Mar 16, 2016 11:50 am ]
Post subject:  Re: Best way to design site that will be viewed web/mobile/a

I want to know what the difference is between the regular website, mobile website, a mobile app, and a desktop application? My current practice is to implement unstyled HTML with appropriate containers for everything needed by all versions. Basic Javascript behaviors are implemented. I then apply CSS, mobile first, to create the look for each different version. Any functionality not used by a version is simply hidden. Selecting the appropriate stylesheet and adaptive behaviors are all done in the browser, so the server side code just delivers HTML and JSON.

What you are doing sounds very complicated -- unless your various versions are completely different.

Author: [ Thu Mar 17, 2016 12:36 am ]
Post subject:  Re: Best way to design site that will be viewed web/mobile/a

Sorry for being unclear.

The difference will be the layout and a little bit of code here and there. I will have different layouts for the Web and mobile versions (the apps will likely use the mobile layout). So, the layout template file will likely be unique. And then, for example, push notifications for desktop and mobile app will need to be coded. The mobile push code would go in the mobile app folder and no where else.

Most pages will be identical. So say there is a profile.php. On the mobile site once the mobile layout is loaded, my code will just grab profile.php from the normal website (/web directory).

But say i wanted the mobile version of profile.php to be very different with different info.. Id make a new profile.php and place it in the mobile web directory.

In pseudo code, each directory's index.php (router) would include pages like this..

If (page exists in this folder)
Include this specific version
Include page from normal /web

This way i could easily just drop in a specific page for, let's say, the mobile Web version. Everything else would remain the same.

As far as mobile app and desktop app, I'm going to use phonegap (or something similar) and node webkit (or something similar). These allow for the apps to just be html/css/Javascript normal Web pages). Initially I'd just do an Ajax get request to display the initial page. Then on page change or form post id get just the content and insect it into the dom. The only actual code in the apps index.html wild be an Ajax get request.

I was thinking of using sub domains instead of folders. That way each version could have its own document root. But I'm really not familiar with this. Good idea?

Thanks for the input both of you. It seems pretty simple but i don't want to code the whole thing for it not to work without significant recoding. I'm sorry if i haven't been clear. Perhaps in a little bit I'll post a sample directory structure and index route script.

Author: [ Thu Mar 17, 2016 12:54 am ]
Post subject:  Re: Best way to design site that will be viewed web/mobile/a

Author:  infolock [ Thu Dec 15, 2016 4:54 pm ]
Post subject:  Re: Best way to design site that will be viewed web/mobile/a

* ReactJS for UI
* NodeJS for Server
* PHP as the API

Concerns nicely separated, code becomes loosely coupled.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group