title: PHP Content Separation
body: <p>So we all know that you should always, not only in PHP, separate code from content/design/html. (I have seen people that say the opposite here today)</p>
  
  <p>I mean, you don't want one of these in bigger projects, do you?</p>
  
  <pre><code>&lt;?php
  
  echo '&lt;div id="blah"&gt;&lt;b&gt;'
       . $username . '&lt;/b&gt;'
       . $stuff . '&lt;more HTML mixed with PHP...&gt;';
  
  ?&gt;
  </code></pre>
  
  <p>But: What is a good approach to separate code from content?</p>
  
  <p><strong>I have been using a simple template system that replaces wildcards in templates mostly.</strong></p>
  
  <p>e.g:</p>
  
  <pre><code>&lt;div id="blah"&gt;&lt;b&gt;%USERNAME%&lt;/b&gt;%STUFF% &lt;...&gt;
  </code></pre>
  
  <p>(located in a single file)</p>
  
  <p>Later you can just call a function similar to <code>GetTemplate( 'myTemplate', array ( 'USERNAME' =&gt; 'Stranger' ) );</code></p>
  
  <p><strong>Finally, the questions:</strong></p>
  
  <ul>
  <li>Is this a good way of separating code and content?</li>
  <li>How do you do that when not working with a framework?</li>
  <li>Is there a better way?</li>
  </ul>