title: Zend Framework - use a common header for different actions in a controller?
body: <p>I've tried reading the question found HERE: <a href="https://stackoverflow.com/questions/1614742/module-configuration-and-layout-configuration-in-zend-framework">Module configuration and layout configuration in zend framework</a>  It was described as being everything I need to know about layouts - but - I'm afraid I'm finding it a bit difficult to understand.</p>
  
  <p>I've got a number of Zend controllers:</p>
  
  <pre><code>class FirstController extends Zend_Controller_Action {
     public function init()        { /* stuff */ } 
     public function indexAction() { /* stuff */ } 
     public function indexBrowse() { /* stuff */ } 
  }
  
  class SecondController extends Zend_Controller_Action {
      // stuff   
  }
  
  class ThirdController extends Zend_Controller_Action {
      // stuff
  }
  </code></pre>
  
  <p>I need them to have the following arrangement.</p>
  
  <ol>
  <li>FirstController & Second Controller share a header</li>
  <li>FirstController - indexAction and browseAction share an additional header</li>
  <li>Thirdcontroller - has it's own header or possibly "no header" (for ajax)</li>
  </ol>
  
  <p>As it stands, I'm getting tremendous replication in the <code>view/script/&lt;actionname&gt;.phtml</code> file <a href="http://framework.zend.com/manual/en/zend.layout.quickstart.html" rel="nofollow noreferrer">http://framework.zend.com/manual/en/zend.layout.quickstart.html</a></p>
  
  <p>Has more information but I've not been able to find the key pieces of information that bring this all home for me. </p>
  
  <p>From the first document above I'm guessing the following goes into my <code>application.ini</code> file</p>
  
  <pre><code> resources.layout.layout = "layout"
   resources.layout.layoutPath = APPLICATION_PATH "/layouts"
  </code></pre>
  
  <p>But am I expected to create a folder called "Layouts" or should I be using some sort of <code>views/common</code> folder?  Is the file then called <code>layout.php</code> ?</p>
  
  <p>Then, inside the <code>layout.php</code> am I understanding correctly that </p>
  
  <pre><code>    &lt;div id="content"&gt;&lt;?php echo $this-&gt;layout()-&gt;content ?&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Will render the individual action's <code>PHTML</code> file?  and</p>
  
  <pre><code>   public function anotherAction() {
          $this-&gt;_helper-&gt;layout-&gt;setLayout('foobaz');
     }
  </code></pre>
  
  <p>Would make the entire action use a different layout file (one in the layouts folder called 'foobaz.php')?</p>
  
  <p>Thanks for taking the time to clear this up for me.</p>