setting site to always use mobile views - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: setting site to always use mobile views (/showthread.php?tid=49118) |
setting site to always use mobile views - El Forum - 02-08-2012 [eluser]bobbob[/eluser] I am looking for an elegant solution that will always load the correct view. For example I was considering something like this: Code: if($this->agent->is_mobile()) //Then I could load any view: Code: $this->load->view($this->session->userdata("agent").'anyview'); // then as long as I have a view for each mobanyview.php and anyview.php 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 setting site to always use mobile views - El Forum - 02-08-2012 [eluser]spurs_fan11[/eluser] Have you considered the concept of responsive web design? Fantastic article here about this technique: http://www.alistapart.com/articles/responsive-web-design/ 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. http://foundation.zurb.com/ * You'll have to copy/paste the links as this forum blocks me from using that feature. :/ setting site to always use mobile views - El Forum - 02-08-2012 [eluser]bobbob[/eluser] 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, setting site to always use mobile views - El Forum - 02-08-2012 [eluser]InsiteFX[/eluser] Do asearch for 1140 fluid grid get that works with phones and mobile setting site to always use mobile views - El Forum - 03-19-2012 [eluser]ToddyBoy[/eluser] What would you suggest if I wanted to display different data depending on user agent? setting site to always use mobile views - El Forum - 03-19-2012 [eluser]skunkbad[/eluser] 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 ); setting site to always use mobile views - El Forum - 04-06-2012 [eluser]ghprod[/eluser] [quote author="InsiteFX" date="1328748322"]Do asearch for 1140 fluid grid get that works with phones and mobile [/quote] Thank insite, i've searched and found this http://cssgrid.net/ they had feature for auto resize image to fit with coloumn width .. nice one |