title: Handling Dynamic Content in CodeIgniter (Best Practice)
body: <p>I'm creating a website with CodeIgniter &amp; have a question on best practice.</p>
  
  <p>I generally break my webpages up into modular chunks.  Header, Content, Footer (and some other stuff sprinkled in between as needed.</p>
  
  <p>The 'Header' and 'Footer' chunks are usually static, while the guts in between can change depending on a few variables (the actual page for example - home, about, contact etc.)</p>
  
  <p>Below is the controller for the page.  header_view, navigation_view, and footer_view will (most likely) never change.  The home_main_view will.</p>
  
  <pre><code>public function index()
  {
      $this-&gt;load-&gt;view('header_view');
      $this-&gt;load-&gt;view('navigation_view');
      $this-&gt;load-&gt;view('home_main_view');
      $this-&gt;load-&gt;view('footer_view');
  
  }
  </code></pre>
  
  <p>If a user navigates to the about page for example, the views may look something like this:</p>
  
  <pre><code>public function index()
  {
      $this-&gt;load-&gt;view('header_view');
      $this-&gt;load-&gt;view('navigation_view');
      $this-&gt;load-&gt;view('about_view');
      $this-&gt;load-&gt;view('footer_view');
  
  }
  </code></pre>
  
  <p>How would I handle that change in CI?  Is it best to make home_main_view a variable and pass is into the index() function?  I've done this before (user clicks a link that triggers a function in the controller that sets $var that calls index($var) that calls view($var).</p>