mardi 4 août 2015

Triple inheritance

I have a main template that adds scripts, styles, etc - let's call it main.tpl file:

<!DOCTYPE>
<html>
 <head>
  ...
 </head>
 <body>
  {block name=body}{/block}
  <script src="..."></script>
 </body>
</html>

Then I have a file that adds a template to the website, let's call it template.tpl:

{extends file="template.tpl"}
{block name=body}
 <div class="container">
  <div class="template">
   <div class="menu">
    ...
   </div>
   {block name=body}{/block}
  </div>
 </div>
{/block}

And finally I have the file that I call from the controller, and want it to extend the other two:

{extends file="template.tpl"}
{block name=body}
 <div class="my-content">
  Hello world!
 </div>
{/block}

Ok, the problem is that the template.tpl is not attached to the website source. I mean, whatever I put inside template.tpl's body block, it won't matter, because it's never loaded.

How can I solve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire