Skip to main content
1 of 4

Web design patern

I am building a small website, in PHP and I am using MVC design pattern for the UI.
In the future I will need to add mobile support for my website. It will be in the sub domain "m" like everyone.

All the web is new for me, and I am new with MVC too. I did for each page View, Model and Controller. The Views and the Models are in some internal directory, and the controller is in the public directory of the server (the servers root directory).

My Questions:

  1. Do I need to create a new MVC design for the mobile pages, or can I use the Model of the regular website?

  2. Most of sites have "m" sub-domain for mobile web pages. But the only thing that need to change is the View part. If the public page is the Controller, why not to create only Views for the mobile pages, and the Controller will decide which View will present? Like:

    if ($isMobile) {
    include 'mobiles\main.php';
    } else {
    include 'web\main.php';
    }