$template = new XTemplate('template.html'); $template->assign('title', 'My Page Title'); $template->assign('content', 'This is the content of my page'); $template->parse('main'); $template->out('main');
$template = new XTemplate('template.html'); $data = array('title' => 'My Page Title', 'content' => 'This is the content of my page'); $template->assign($data); $template->parse('main'); $template->out('main');
$template = new XTemplate('template.html'); $data = new stdClass(); $data->title = 'My Page Title'; $data->content = 'This is the content of my page'; $template->assign($data); $template->parse('main'); $template->out('main');In all these examples, the XTemplate package library is used to assign values to placeholders in an HTML template and display the resulting page.