Re: [Phplib-users] Using a template as the content of another template.
Brought to you by:
nhruby,
richardarcher
|
From: Layne W. <la...@if...> - 2002-07-01 14:36:29
|
> Does the PHPLib template system allow one template to be
> included into another template?
Yes. As long as you parse the inner template file before parsing the outer
template file you'll be just fine.
---- outer.tpl ---
<html>
<body>
{inner}
</body>
</html>
---- inner.tpl ---
<h1>{title}</h1>
<p>{some_text}</p>
---- example.php
<?php
include "template.inc";
$t = new Template;
$t->set_file("outer", "outer.tpl");
$t->set_file("inner", "inner.tpl");
$t->set_var(array("title" => "An Example", "some_text" => "It's really very
simple once you get the hang of it."));
$t->parse("inner", "inner");
$t->parse("outer", "outer");
$t->p("outer");
?>
Layne Weathers
Ifworld Inc.
|