[PHPTAL] Include templates

BuKoX poczta at bukox.pl
Tue Jun 12 10:45:35 CEST 2007


lbedubourg pisze:

> For each template.
> 
> You can have ONE design.html which contains you base design in one macro :
> 
> <html metal:define-macro="main">
>   <head>
>     <title>Hello</title>
>   </head>
>   <body>
>     <div id="header">
>       <h1>Hello</h1>
>     </div>
>     <div id="menu">
>       <ul>
>         <li><a href="/">Home</a></li>
>     <li><a href="/about">About</a></li>
>         ...
>       </ul>
>     </div>
>     <div id="content">
>        <metal:block define-slot="content"/>
>     </div>
>     <div id="footer">
>         Copyright (c) ...
>     </div>
>   </body>
> </html>
> 
> And then you just call your design from each template :
> 
> <html metal:use-macro="design.html/main">
>   <body metal:fill-slot="content" tal:ignore-tag="">
>     <h1>My content</h1>
>     foo bar baz
>   </body>
> </html>
> 
> You might have to write a little big more template code to achieve the 
> same result (because tal is quite verbose and metal is not so simple) 
> but each of your template will be valid XML, the final result will be 
> valid XML, you will have less templates files to manage and changing the 
> design will be a peace of cake.

Thx. That's is what I was looking for. I understand the idea of phptal 
tenplates now.

pozdrawiam...

-- 
  __               __       _______________________________________
|__\\ |  || |_// /  \\ \_//        Portfolio: http://bukox.pl     |
|__// |__|| | \\ \__// / \\__Total Commander: http://totalcmd.pl /



More information about the PHPTAL mailing list