setting site to always use mobile views

I am looking for an elegant solution that will always load the correct view.
For example I was considering something like this:

$this->session->set_userdata("agent") = "mob";
$this->session->set_userdata("agent") = "";

//Then I could load any view:


// then as long as I have a view for each

So has anyone got a better way of doing this?
Ideally I'd like to set this in the index.php file once or at least somewhere only once.
Any ideas how to handle this or a another way?

Oops wrong forum Smile

Have you considered the concept of responsive web design? Fantastic article here about this technique:

I'm currently using the foundation CSS framework to achieve this. If you add in some CSS media queries then you can create desktop/tablet/mobile sites very easily without the need to query the user agent within codeigniter.

* You'll have to copy/paste the links as this forum blocks me from using that feature. :/

I think using foundation might be the answer.
I love alistapart. It is in my rss reader.
I read that article then but now it is more relevant to me. Just reread it.

Still interested if there is a way to hook into codeIgniter earlier in its process to set a more global $variable for the user agent.

Thanks spurs_fan11,

Do asearch for 1140 fluid grid get that works with phones and mobile

What would you suggest if I wanted to display different data depending on user agent?

You could set the template in MY_Controller based on whatever logic you want to use.

$this->template = 'templates/mobile';

This is nice because you can use that to load the view in any controller method.

$this->load->view( $this->template );

[quote author="InsiteFX" date="1328748322"]Do asearch for 1140 fluid grid get that works with phones and mobile

Thank insite, i've searched and found this
they had feature for auto resize image to fit with coloumn width .. nice one Smile

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.