Welcome Guest, Not a member yet? Register   Sign In
System vs Application
#1

[eluser]Michael Geeh[/eluser]
Hey guys, i'm currently designing an entertainment website wth a forum. Its supposed to have both a web version and a mobile version i have completed the web version and i'm nw starting the mobile one. The mobile version is a subdomain of the main domain, http://m.example.com. I'm wondering, wud it be better if i did the mobile version as a separate application or as a completely separate codeigniter installation? I'm not a pro programmer so please just help me out
#2

[eluser]Dam1an[/eluser]
The only major change between the 2 should be the views, so you could do it all in the same application.
To make this transparent to yourself while development, you could make a slight change to the loader class where it specifies the views directory. You would do this based on either the URl or the user agent, so you could have a mobile and web directory beneath the views directory, and they would have the same files in both of them, but the ones in the mobile would obviously be optimised for small screen rendering
#3

[eluser]xwero[/eluser]
The easiest solution is to add a global to the desktop version and mobile index.php for example
Code:
define('DEVICE','desktop');
And you adjust the data fetching and views to display using that global.

With this method you have one application which makes the code more maintainable. On the other side you methods will become a bit more complex.
#4

[eluser]Michael Geeh[/eluser]
I've tried out Dam1an's way bt i need to assign a random string to prevent the phone browser frm caching the page. I keep getting a preg match error.
#5

[eluser]Michael Geeh[/eluser]
Xwero, if you don't mind, would you please explain a bit more?
#6

[eluser]xwero[/eluser]
You create a directory structure like this

- ci
-- application
-- system
- public_html
-- index.php
-- m
--- index.php

In the index.php files you point the application and system path variables to the child directories of the ci directory. In the public_html index.php you add
Code:
define('DEVICE','desktop');
And in the m/index.php file
Code:
define('DEVICE','mobile');

Now you can use the DEVICE global in your site code as a flag to fetch the data and display the views you need for the device.
Code:
function news()
{
   if(DEVICE == 'desktop')
   {
      $data['content'] = $this->news_model->get_synopsis();
      $this->load->view('desktop/news',$data);
   }
   else
   {
     $data['content'] = $this->news_model->get_titles();
     $this->load->view('mobile/news',$data);
   }
}
This is verbose code but it gives you an idea.
#7

[eluser]Unknown[/eluser]
I’ve tried out Dam1an’s way bt i need to assign a random string to prevent the phone browser frm caching the page.
#8

[eluser]Unknown[/eluser]
Have you tried using the the HTTP Cache-Control header?

In order to tell it to not cache, try using:
Cache-Control: no-cache




Theme © iAndrew 2016 - Forum software by © MyBB