title: PHP MVC, partial views?
body: <p>I'm building a small PHP MVC, and I've hit a wall with a small area of the coding. I think I need "partial views", but I might be able to achieve something with the existing code.</p>
  
  <p>My controller in it's simplest form currently:</p>
  
  <ul>
  <li>Instantiates an object </li>
  <li>Checks if a POST variable isset</li>
  <li>Displays view 1 or displays view 2 as    necessary</li>
  </ul>
  
  <p>The view(s) currently:</p>
  
  <ul>
  <li>Displays HTML markup</li>
  <li>Use and echos the models get functions such as getUserInfo()</li>
  </ul>
  
  <p>Everything is working great, however the code is now getting fairly large in both the controllers and views, and I've reached a situation where I need to include "modules" or sub views inside the main views (1 and 2).</p>
  
  <p>For example if view2 is loaded, then I need to display (as part of the view2) another view, say a 3 part sign up registration form. This registration form comes with it's own controller file too.</p>
  
  <p>I can do something like this, which will work and give you some idea of what I am trying to do, but I acknowledge this breaks MVC design patterns.</p>
  
  <p>View</p>
  
  <pre><code>&lt;div id="mydiv"&gt;Some content&lt;/div&gt;
  &lt;div id="mysignup"&gt; &lt;?php include('controller_signup.php'); ?&gt;&lt;/div&gt;
  &lt;div id="content"&gt; The views main page content &lt;/div&gt;
  </code></pre>
  
  <p>The view is then pulled in from the controller, in the right place. </p>
  
  <p>As mentioned, I think I need to use partial views, however most of the info I've found is for ASP, and I'm slightly lost!</p>
  
  <p>I would have thought this is a fairly common problem, so I assume there is an obvious solution!</p>
  
  <p>Thanks!</p>