For complex pages, I cant totally rely on responsive design. I would like to write view code in different files.
As long as I see, there are two solutions.
[*]Inherit and overwrite Views’s render() method, inside the new render(), detect the device, and design which file should be use, i.e: page.html or page.mobile.html.
[*]Create a new theme called ‘mobile’. Design which theme to use in beforeAction() or beforRequest();
Can anyone tell me which is better. Or may be both are not good enough? Are there other better ones? Thanks.
Using a theme called mobile, and changing the theme used is better, because only one variable changes, the rest of views keeps with same name.
Yes, using theme is simpler. However I wonder if it is a good practice to use theme in this way. I think theme is more about styles (as what its name mean). For example,
a "forest" theme or a "iron" theme. Maybe one day we will need forest theme on both PC and mobile?
Sorry I make a mistake, View should be inherited rather than Controller. Modified.