I have a desktop version of a site built with codeigniter ,and am creating the mobile version. I create a sub d开发者_如何学Comain, m.xyz.com whose document root is public_html/m I have also place an index.php file in the /m folder and edited the $system_folder and $application_folder to point the application and system folder of the desktop site in order to share controllers and models. But when i try out the mobile domain, it still renders the desktop site. What do i need to do to fix this
Use the User Agent Class: http://codeigniter.com/user_guide/libraries/user_agent.html
Use this in your controller to determine whether or not the user is on a mobile device:
if($this->agent->is_mobile())
{
// handle mobile devices
}
And then render your mobile views inside the if.
精彩评论