I am not sure why this is not working! I have the code below in my beforeFilter() function inside my AppController, I am using CakePHP 2.2.2, I started using ‘$this->RequestHandler->isMobile()’ but that gave me an error. Looking at the CakePHP website I found that they had change the call to what I now use below.
However this does not work, when I view my site on my iPhone it should only echo a test message set on the view file, however it still goes to the default.cpt file for the whole site, which I thought should have been stop with the autoRender command?
So what I am doing wrong or have I not done something I should have?
if($this->request->is('mobile')) {
$this->isMobile = true;
$this->set('isMobile', true );
$this->autoRender = false;
$this->render('../mobile/test');
}
Many Thanks Glenn.
Have you tried something like this? Not able to test it, but it looks like it should work.