title: CakePHP - Creating 2 $content_for_layout variables
body: <p>I am working on a complete redesign for my company and I have run into a problem. We are building if off the Cake Framework (1.2.0.7296 RC2) and I am trying to find the best solution to create a solid layout template. The design I have created has multiple wrappers throughout each page. Below is a simplified version of the code.</p>
  
  <pre><code>&lt;body style="background:url(somebackground.png);"&gt;
      &lt;div class="page"&gt;
      &lt;!--Page is used to constrain the content within a specific width--&gt;
          &lt;div class="header"&gt;
          &lt;div class="nav"&gt;
  
        &lt;/div&gt;&lt;!--End Nav--&gt;
      &lt;/div&gt;&lt;!--End Header--&gt;
      &lt;div class="content"&gt;
        &lt;!--This area contains a slideshow and other info that varies from page-to-page--&gt;
      &lt;/div&gt;&lt;!--End Content--&gt;
   &lt;/div&gt;&lt;!--End Page--&gt;
   &lt;div class="wrapper" style="background:url(someotherbackground.png);"&gt;
      &lt;div class="page"&gt;
      &lt;div class="content"&gt;
          &lt;!--Additional content--&gt;
      &lt;/div&gt;&lt;!--End Content--&gt;
    &lt;/div&gt;&lt;!--End Page--&gt;
   &lt;/div&gt;&lt;!--End Wrapper--&gt;
   &lt;/body&gt;
  </code></pre>
  
  <p>The problem is that in a Cake layout there is only one $content_for_layout, which would work for most websites. However, because of how I have structured things, it makes it difficult to take full advantage of the layout template. The only solution I have thought of was as follows.</p>
  
  <ul>
  <li>Close the top div class='page after the header and then add another div class='page' underneath of it. That way I would be able to put the header and nav in elements and keep them  only in the layout template. The problem with that is I am not taking full advantage of the template, because I am still going to be repeating the a lot of the html.</li>
  </ul>
  
  <p>Ideally I would like to have 2 $content_for_layout. One for the content underneath the first page and another for the content on the second. That way I can use the layout template to the fullest. Then on my page I would have a section where I can place the perspective content. In my research for this problem I found some solutions.</p>
  
  <ul>
  <li><a href="http://cakephp.1045679.n5.nabble.com/Multiple-content-for-layout-td1281556.html" rel="nofollow">http://cakephp.1045679.n5.nabble.com/Multiple-content-for-layout-td1281556.html</a></li>
  <li><a href="http://bakery.cakephp.org/articles/rtconner/2007/08/28/anything_for_layout-making-html-from-the-view-available-to-the-layout" rel="nofollow">http://bakery.cakephp.org/articles/rtconner/2007/08/28/anything_for_layout-making-html-from-the-view-available-to-the-layout</a></li>
  </ul>
  
  <p>I am not sure if these are the best solutions or are going to give me what I am looking for. I am a designer and frontend developer, so my knowledge of Php is limited. My knowledge of Cake is even more limited. I am looking for the simplest solution.</p>