开发者

Mobile site with codeigniter sharing resources

开发者 https://www.devze.com 2023-04-10 18:16 出处:网络
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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消