Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Instead of rewriting your code all over the place, you can just load a different view folder. In essence what will happen is you can just have CodeIgniter load a different view with the same name from another folder everytime you use $this->load->view("xxx"). First, create a new folder in your view folder called /mobile and just create views with the same exact naming conventions and it will load the the view accordingly by extending the Loader.php class. </p> <p>Whether you are doing a responsive design or if you are going to create an iPhone app looking mobile version of your site, kind of like what facebook does, then you can just override the Loader class in the core folder. In your application/core folder create a MY_Loader.php and put it in that file.</p> <p>Mine looks like the following</p> <pre><code>&lt;?php if (! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Loader extends CI_Loader { //overides existing view function function view($view, $vars = array(), $return = FALSE) { $CI =&amp; get_instance(); $CI-&gt;load-&gt;library("user_agent"); if($CI-&gt;agent-&gt;is_mobile()){ $view = 'mobile/'.$view; } return $this-&gt;_ci_load(array('_ci_view' =&gt; $view, '_ci_vars' =&gt; $this-&gt;_ci_object_to_array($vars), '_ci_return' =&gt; $return)); } } ?&gt; </code></pre> <p>Responsive web design is a mess in my opinion, but this still separates the code for you very nicely, while still being able to use your controllers and models in unison.</p> <p>Hope this helps. This is the way I will be going about it :) !</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload