<? Php
Include ('Template. Inc'); // contains the template class template. inc.
// Create an instance
$ Tpl = new Template ("template ");
// Read the content of the three template files, respectively, to the variables "main", "child_header", "child_footer"
$ Tpl-> set_file ("main", "NestingMain.html ");
$ Tpl-> set_file ("child_header", "NestingHeader.html ");
$ Tpl-> set_file ("child_footer", "NestingFooter.html ");
// Replace the template variables in the template child_header and child_footer, and assign the final results to the header and footer in the main template respectively.
$ Var_array = array ('title' => 'Title: table attribute ',
'Author' => 'kiki ',
);
// An array can be passed.
$ Tpl-> set_var ($ var_array );
$ Tpl-> parse ("header", "child_header ");
$ Tpl-> parse ("footer", "child_footer ");
// Replace the variables in the main template and output the analyzed content of the main template.
$ Tpl-> parse ("myout", "main ");
// Output
$ Tpl-> p ("myout ");
?>