Using two different "view" folders


I need to use two different view folders, one for mobile apps and one for web browser apps.

How do I do this?


I know the code to test for mobile browsers, but how do I get different view folders displaying on the condition.

Why not just use a responsive design framework so your site will scale on mobile browsers?

Are you going to detect browser in the controller and render accordingly?

You can do this by overriding the function getViewPath() in your main controller. E.g.

// In the Controller class:

public function getViewPath() {

    // Set boolean variable $mobile to true if on mobile browser 

    $mobile = true;  // set this correctly, by actually determining if on mobile device or not

    $viewPath = parent::getViewPath();

    if ($mobile) {

        return "{$viewPath}/mobile";

    } else {

        return "{$viewPath}/browser";





Thanks this is exactly what I need.


Well I think we have decided to go with JQuery Mobile framework for this.

It will require that I change both the html and the css. This is why I need two view folders.

Ideally it would have been nice to do this purely with CSS but I do not think its possible now.