title: PHP View, working with templates
body: <p>Well, my question is very simple but a little hard to accept the solution, but anyway .. is the following, I have a '<code>mini-framework</code>', something to work on writing up of a single scheme, helps me a lot, accelerate work on some things, however, the question is even with the view, in a way, using a scheme of templates is very easy and also very interesting because when you have to change anything <code>related to visualization</code>, the template changes only, but then, in time to <code>render this template</code>, which is the best way? I'm currently working this way:</p>
  
  <pre><code>&lt;?php
  
            class View {
  
                   private $vars;
  
                   public function __get ( $var ) {
                          if ( isset( $this-&gt;vars [ $var ] ) ) {
                                 return $this-&gt;vars[ $var ];
                          }
                   }
  
                   public function assign ( $var , $value ) {
                          $this-&gt;vars [ $var ] = $value;
                   }
  
                   public function show ( $template ) {
                          include_once sprintf ( "%s\Templates\%s" , __DIR__ , $template ) ;
                   }
  
            }
  </code></pre>
  
  <p>It is not the complete code, I am building structures and reviewing the scheme yet, so I do the following ..</p>
  
  <pre><code>&lt;?php
            require_once 'MVC/Views/View.php';
            $View = new View ( ) ;
  
            $View-&gt;assign( 'title' , 'MVC, View Layer' ) ;
            $View-&gt;show ( 'test.phtml' );
  </code></pre>
  
  <p>And the template</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
         &lt;head&gt;
                &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /&gt;
                &lt;title&gt;&lt;?php echo $this-&gt;title ?&gt;&lt;/title&gt;
         &lt;/head&gt;
         &lt;body&gt;
  
         &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The output is correct, <code>all working as expected</code>, but my question is: is this the best way to do? including the file and letting the play interprets the code written in <code>.phtml</code></p>