Имеется два шаблона
main.tpl<html><head><title>{TITLE_}</title></head><body>{MAIN}</body></html>
и
page.tpl<b>Name:</b> {Name}<b>Last Name:</b> {LastName}
Используя класс для работы с FastTemplate, написать программу, которая по данным шаблонам генерирует html-страницу с заголовком «Test page» и содержанием вида:
Name: Иван Last Name: Петров
(Отметьте один правильный вариант ответа.)
Варианты ответа
<?php /* START */include("class.FastTemplate.php3");$tpl = new FastTemplate("c:/users/path/to/templates");$tpl->define(array( main => "main.tpl", page => "page.tpl")); $tpl->assign(TITLE_, "Test page");$tpl->assign(Name, "Иван");$tpl->assign(LastName, "Петров");$tpl->parse(MAIN, array("page","main"));$tpl->FastPrint();?>(Верный ответ)
<?php /* START */include("class.FastTemplate.php3");$tpl = new FastTemplate(".");$tpl->define(main => array( Name => "Иван", LastName => "Петров", TITLE_ => "Test page"));$tpl->parse(MAIN, "page");$tpl->parse(MAIN, ".main");$tpl->FastPrint();?>
<?php{* START *}include("class.FastTemplate.php3");$tpl = new FastTemplate("c:/users/path/to/templates");$tpl->define(array( main => "main.tpl", page => "page.tpl")); $tpl->assign(TITLE_, "Test page");$tpl->assign(Name, "Иван");$tpl->assign(LastName, "Петров");$tpl->display(main.tpl);?>
<?php /* START */include("class.FastTemplate.php3");$tpl = new FastTemplate("c:/users/path/to/templates");$tpl->define(array( main => "main.tpl", page => "page.tpl")); $tpl->assign(Title_, "Test page");$tpl->assign(NAME, "Иван");$tpl->assign(LASTNAME, "Петров");$tpl->parse(MAIN, array("page","main"));$tpl->FastPrint();?>