I have created a Zend Framework website and I'm now updating it to switch out the layout file depending on whether or not the user is on a mobile device.
I have written a class to deal with the detection but I don't know where is best to place this check and also trigger the layout file being used.
Code:
include(APPLICATION_PATH . "/classes/MobileDetection.php");
$detect = new MobileDetect();
if ($detect->isMobile()) {
$layout = $layout->setLayout('mobile');
}
I can trigger the layout from the Bootstrap function _initViewHelpers()
but I get a 500 error as soon as I add the include line above.
Any recommendation on how and where to place this? I originally has a helper that dealt with the check but that was used in the layout itself rather than enabling me to swap the whole layout file out.