title: Render a view in PHP
body: <p>I am writing my own MVC framework and has come to the view renderer. I am setting vars in my controller to a View object and then access vars by echo $this->myvar in the .phtml script. </p>
  
  <p>In my default.phtml I call the method $this->content() to output the viewscript.</p>
  
  <p>This is the way I do it now. Is this a proper way to do that? </p>
  
  <p>
  
  <pre><code>class View extends Object {
  
      protected $_front;
  
      public function __construct(Front $front) {
          $this-&gt;_front = $front;
      }
  
      public function render() {                
          ob_start();
          require APPLICATION_PATH . '/layouts/default.phtml' ;            
          ob_end_flush();
      }
  
      public function content() {
          require APPLICATION_PATH . '/views/' . $this-&gt;_front-&gt;getControllerName() . '/' . $this-&gt;_front-&gt;getActionName() . '.phtml' ;
      }
  
  }
  </code></pre>