title: Fat Free PHP Layouts
body: <p>I'm going through some of the code and projects provided here <a href="http://fatfreeframework.com/development" rel="nofollow">http://fatfreeframework.com/development</a>.  My goal is to create a lightweight MVC kickstarter projecting using F3.  I know it's been done before, but I'm using this as a learning exercise and I hope to have something useful come out of it in the end.</p>
  
  <p>The biggest stumbling block I'm coming across right now is the concept of layouts.  I know the documentation mentions using templates within templates, but I'm struggling to implement it in practice.   In the end, I want to have 1 or 2 layouts (default layout, maybe a custom one for modal popups, etc), and then have my views rendered wrapped inside of those layouts.  I want a default layout and then the ability to override the default for the few pages that need custom ones.  Here's the code I've been using:</p>
  
  <pre><code>// this is the handler for one of my routes, it's on a controller class called Index
  public function index($f3, $params) 
  {
      // this (or anything else) should get passed into the view
      $f3-&gt;set('listOfItems',array("item1", "item2"));
  
      // set the view
      $f3-&gt;set('content', 'index.htm')
  
      // render the layout
      \Template::instance()-&gt;render('layout.htm');
  }
  </code></pre>
  
  <p>Unfortunately, I keep getting a blank page.  Am I going about this completely the wrong direction, or am I on the right track?  Is there a way to set a default layout somewhere so it's used until it's overridden?</p>