I've taken over a nightmare of a project! I'm moving a very poorly written site and moving it slowly into a Zend Framework application. Unfortunately I have no time to do the remedial work to make this even bearable (maybe a model or two). I have now been told that it is soon to have mobile version of the site and the proposal has been to clone the old site and work with that. In an attempt to not work on different versions of the same crap and buy myself some time I proposed that the ZF site should handle it all.
Is it awful practice to use Zend_Http_UserAgent to detect then simply load an alternative layout and content?
I was inclined to use two modules at first but I've had a bit of trouble with ACLs in modules.
Any alternative suggestions are welcome!
Cheers
With Zend Framework 1.11 zend introduced the wurfl adapter which is based on Zend_Http_UserAgent.
It allows you to detect mobile devices and bootstrap different layouts. There is a HOW TO on youtube that came with the zend newsletter december 2010: http://www.youtube.com/watch?v=_A8yg73tqOY
You don't have to use different modules! Just different layout files!
if (Zend_Http_UserAgent_Mobile::match($_SERVER['HTTP_USER_AGENT'], $_SERVER)) {
}
A good starting point would be to look at responsive design techniques with css. There are many tutorials out there just google "responsive design" and perhaps you can refactor the existing layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With