title: Codeigniter: Best way to structure partial views
body: <p>How would you structure the below page in Codeigniter?</p>
  
  <p><img src="https://i.stack.imgur.com/7vHtF.png" alt="alt text"></p>
  
  <p>I thought about creating seperate controllers for each section</p>
  
  <ol>
  <li>Left nav</li>
  <li>Content nav</li>
  <li>Login name</li>
  <li>Leaderboard</li>
  </ol>
  
  <p>Excluding the content section (as this changes depending on the link on the left nav and content nav used as a kinda sub-menu). All the other sections remain roughly the same</p>
  
  <p>I thought about doing:</p>
  
  <pre><code>Class User_Profile extends Controller
  {
  
      function index()
      {
          $this-&gt;load_controller('Left_Nav');
          $this-&gt;load_controller('Content_Nav');
          $this-&gt;load_controller('Login_Name');
          $this-&gt;load_controller('Leaderboard', 'Board');
  
          $this-&gt;Left_Nav-&gt;index(array('highlight_selected_page' =&gt; 'blah'));
  
          $this-&gt;load('User');
  
          $content_data = $this-&gt;User-&gt;get_profile_details();
  
          $this-&gt;view-&gt;load('content', $content_data);
  
          $this-&gt;Login_Name-&gt;index();
          $this-&gt;Board-&gt;index();
      }
  
  }
  </code></pre>
  
  <p>Obviously this <code>load_controller</code> does not exist but this functionaility would be useful. The controller for each section gets the data required from the model and then loads the page through <code>$this-&gt;view-&gt;load()</code></p>
  
  <p>It could be a headache to have this code in all the left nav links like News, Users, About Us, etc.. But then again not every nav link has all those sections so I need that flexability of having the sections as a "partial view"</p>
  
  <p>Can anyone suggest a better way of doing this?</p>