Welcome Guest, Not a member yet? Register   Sign In
User-Agent
#5

[eluser]TheFuzzy0ne[/eluser]
Also, an observation on the code you posted. It might be wise to extend the Loader, and override the view() method. You can add a little logic in there that will automatically append '_mobile' to the end of the filename string if it's a mobile request, but only if the mobile view file exists. If not, then it can just fallback on the regular view, and if that's not available, CodeIgniter can just chuck a wobbler as normal.

I just thought it might save you from repeatedly having to type:
Code:
if ($this->agent->is_mobile()) {
    $this->load->view('some/view_mobile', $data);
} else {
    $this->load->view('some/view', $data);
}

Instead you'd just type:
Code:
$this->load->view('some/view', $data);
...and the rest is taken care of for you.


Messages In This Thread
User-Agent - by El Forum - 05-30-2013, 08:23 AM
User-Agent - by El Forum - 05-30-2013, 10:09 AM
User-Agent - by El Forum - 05-30-2013, 12:21 PM
User-Agent - by El Forum - 05-30-2013, 02:33 PM
User-Agent - by El Forum - 05-30-2013, 02:44 PM
User-Agent - by El Forum - 05-30-2013, 02:47 PM
User-Agent - by El Forum - 05-30-2013, 04:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB