title: Best approach to include header and footer files in smarty
body: <p>I just start using smarty. I’m just bit confuse how to joint files together. Simply said I want to join header and footer in other files such as index and post</p>
  
  <p>So I created a header.php and header.tpl and added the code below to header.php</p>
  
  <pre><code>$header_template = new Smarty;
  $header_template-&gt;debugging = false;
  $header_template-&gt;caching = false;
  $header_template-&gt;setTemplateDir('./templates/');
  $header_template-&gt;assign("title", $home_title);
  $header_template-&gt;assign("description", $output_cities);
  $header_template-&gt;display('header.tpl');
  </code></pre>
  
  <p>And then I created an index.php and index.tpl file and in index. php added below code</p>
  
  <pre><code>include('header.php');
  $index_template = new Smarty;
  $index_template-&gt;debugging = false;
  $index_template-&gt;caching = false;
  $index_template-&gt;setTemplateDir('./templates/');
  $index_template-&gt;assign("posts", $post);
  $index_template-&gt;display('index.tpl');
  </code></pre>
  
  <p>But in smarty documentation they ask to use <code>{include file=header.tpl'}</code>
  So I’m not sure whether I’m doing this the correct way. Appreciate any answer that you can give me. </p>