title: Smarty general block code inheritance
body: <p>Is it real to get block content from parent file to child?
  For example, I have 3 files <code>parent.tpl</code> &amp; <code>first-child.tpl</code> &amp; <code>second-child.tpl</code></p>
  
  <p>Parent contains that code:</p>
  
  <pre><code>&lt;div&gt;
      {block name='greetings'}{/block}
  &lt;/div&gt;
  </code></pre>
  
  <p>First-Child contains:</p>
  
  <pre><code>{extends file="parent.tpl"}
  {block name='greetings'}
      &lt;h1&gt;Hello! I'm child&lt;/h1&gt;
  {/block}
  </code></pre>
  
  <p>Second-Child contains same as first greetings block (same text only), but instead of <code>h1</code> tag, second-child use <code>h4</code> tag:</p>
  
  <pre><code>{extends file="parent.tpl"}
  {block name='greetings'}
      &lt;h4&gt;Hello! I'm child&lt;/h4&gt;
  {/block}
  </code></pre>
  
  <p>I don't want to duplicate that text <code>Hello! I'm child</code> in each child, but put this into own block. 
  It can be done that way: Create new file <code>greeting_text.tpl</code> and include them into each child, but I don't want to allocate for that own file. I tried to declare that text into <code>parent.tpl</code>:</p>
  
  <pre><code>...
  {block name='greetings_text'}Hello! I'm child{/block}
  </code></pre>
  
  <p>And get that from children:</p>
  
  <pre><code>{extends file="parent.tpl"}
  {block name='greetings'}
      &lt;h1&gt;{block name='greetings_text'}{/block}&lt;/h1&gt;
  {/block}
  </code></pre>
  
  <p>and second-child:</p>
  
  <pre><code>{extends file="parent.tpl"}
  {block name='greetings'}
      &lt;h4&gt;{block name='greetings_text'}{/block}&lt;/h4&gt;
  {/block}
  </code></pre>
  
  <p>But I understood it's impossible to take <code>block</code> content from parent to child. Or maybe i'm wrong. 
  Please give me advice, how I can do that except put <code>greeting_text</code> into their own file and include them in children? Thanks!</p>
  
  <hr>
  
  <p><strong>EDITED:</strong> </p>
  
  <p>Sorry, previous question text was a little bit incorrect (not fully describe what I'm trying to do)</p>
  
  <p>How wrote <strong>sofl</strong>, it's work with <code>append</code> construction. But problem is, that i have 3 files, and two of them extendable (layout.tpl, default.tpl and page.tpl)</p>
  
  <p><strong>layout.tpl</strong> </p>
  
  <pre><code>&lt;div class="layout"&gt;
    {block name="content"}{/block}
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>default.tpl</strong></p>
  
  <pre><code>{extends file="layout.tpl"}
  
  {block name='menu'}
    &lt;ul&gt;
        &lt;li&gt;Link 1&lt;/li&gt;
        &lt;li&gt;Link 2&lt;/li&gt;
        &lt;li&gt;Link 3&lt;/li&gt;
    &lt;/ul&gt;
  {/block}
  </code></pre>
  
  <p><strong>page.tpl</strong> </p>
  
  <pre><code>{extends file="default.tpl"}
  
  {block name="content"}
    &lt;div class="first-page-example"&gt;
        {block name='menu' append}{/block}
  
        &lt;span&gt;I'm text only for first page....&lt;/span&gt;
    &lt;/div&gt;
  {/block}
  </code></pre>
  
  <p>I launch <code>page.tpl</code> (<code>$smarty-&gt;display('page.tpl')</code>), and i wanted to get <code>menu</code> from <code>default.tpl</code> to each child (<code>page.tpl</code>, p.s. there can be many child page1.tpl, page2.tpl,... But for all of them, needed to put default menu from <code>default.tpl</code>) And put that all to <code>layout.tpl</code> like a <code>content</code>. So how i can do that with <code>block</code> construction? Please, any advices. </p>