php - CI routing $this->agent->is_mobile() -
is there way in ci routing file can find out if view using mobile?
and if rotate them different page?
i've got 2 sets of controllers 1 mobile , 1 desktop i'd urls same.
i've tried adding following code routes config file i'm getting error...
am thinking totally wrong?
$this->load->library('user_agent'); if ($this->agent->is_browser()) { $route['default_controller'] = "index"; } elseif ($this->agent->is_mobile()) { $route['default_controller'] = "m/index"; }
the error i'm getting undefined property: ci_router::$load
from examining ci system files, appears loader class loaded after router class, $this->load doesn't exist yet.
check out ci hooks, though: https://ellislab.com/codeigniter/user-guide/general/hooks.html
in addition, might try using head.js (http://headjs.com/) , defining screen widths responsive design. enables build web site , change css change page depending on width of browser. unless aiming @ mobile/desktop due functionality, screen size common reason care on, right? so, if screen size, think head.js system way go. have 1 codebase of server-side stuff worry about.
Comments
Post a Comment