Hi Runar,
this is done via Macros.
Lets say you have one file (macros.html) containing your header, footer, etc. containing this code:
HTML Code:
<div metal:define-macro="header">
Your header here
</div>
<div metal:define-macro="footer">
Your footer here
</div>
In your HTML page you just write
HTML Code:
<div metal:use-macro="macros.html/header" />
and
HTML Code:
<div metal:use-macro="macros.html/footer" />
where you want them to be.
Way better is to use slots:
Lets say you have one template for all your pages (template.html):
HTML Code:
<html metal:define-macro="page_template">
<head></head>
<body>
<tal:block metal:define-slot="content" />
</body>
</html>
Create another file (page.html):
HTML Code:
<tal:block metal:use-macro="template.html/page_template">
<tal:block metal:fill-slot="content">
Your static Content here
${dynamic_content}
or
<span tal:content="another_dynamic_content" />
</tal:block>
</tal:block>
To render this just call
PHP Code:
$phptal = new PHPTAL();
$phptal->setSource('page.html');
$phptal->dynamic_content = 'something';
$phptal->another_dynamic_content = 'something else';
echo $phptal->execute();
That's all. Btw. you can define and fill more than one slot...
You should also read the manual for PHPTAL on
PHPTAL :: Template Attribute Language for PHP
Greetings,
Alex