Search code examples
phpuser-interfacekohanamobile-websitecode-organization

how to organize code for different "mobile device interfaces" and "desktop interfaces"


I am planning for a web application. I am using the PHP framework Kohana with Smarty. My web application will also have mobile device interface. Now, there will be lot of common and lot of separate code for the two interfaces.

How should I organize the the code so that:

  1. There is no duplication of code.
  2. Unnecessary code does not get loaded into. For example, the desktop UI specific code should not get loaded into iPhone interface or vice versa.

Solution

  • Finally I followed the approach of different 2 Project route. Because it gave a lot of flexibility. If I want to share some models, views, controllers I put them in "modules". Else, if I am want to have something separate for two interfaces, I put them in the corresponding project.

    So: my source looks like:

    </>
      proj_desktop/
        htdocs/
        application/
          models/
          views/
          controllers/
      proj_iphone/
        htdocs/
        application/
          models/
          views/
          controllers/
      proj_mobile/
        htdocs/
        application/
          models/
          views/
          controllers/
      modules/
        myApp/
          models/
          views/
          controllers/
      system/
        models/
        views/
        controllers/