Using YII framework (php) for mobile web app and web app

I am currently working on a client proposal that targets the web and mobile web app. There are 61 functions for the web application, and the Mobile web application should have a subset of all functions.

We evaluated the different language levels of the programming language and decided that LAMP was the best one for this. We even went ahead and evaluated the various MVC frameworks in PHP and completed YII.

Now my problem is here. We will be using the same codebase for the mobile and web app. We planned to route all requests with a target “Front-Controller” that checks the “User-Agent” header and has all application controllers in the switch box. Thus, for the Web and mobile application, the Model and Controller code remains unchanged, only the View changes. Depending on the "user agent", the target controller decides to load the appropriate "View". How does this architecture sound to all of you? Does anyone have a better idea? Is this architecture functionally possible in YII? Please tell us about the same.

+3


source to share


2 answers


Sounds like a good and general solution. Here is a blog post on how to switch themes based on browser type:



http://learnyii.blogspot.com/2011/03/yii-theme-iphone-android-blackberry.html

+3


source


We planned to route all requests with the target "Front-Controller" which checks the "User-Agent" header and has all the application controllers in the switch box

Use a filter instead: http://www.yiiframework.com/doc/guide/1.1/en/basics.controller#filter



They are much more efficient and can eliminate things like radio buttons, but still give you full control over the loading of the theme, etc.

+3


source







All Articles