header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Cache-Control: post-check=0,pre-check=0", false); header("Cache-Control: max-age=0", false); header("Pragma: no-cache"); /***** Подключение необходимых библиотек *****/ include 'php/xtemplate.class.php'; include 'php/user.class.php'; include 'php/globalFunctions.php'; /***** Инициализация глобальных переменных и объектов *****/ session_start(); $template = new XTemplate("index.html"); $client = new user(); /***** Сборка основного шаблона *****/ $template->assign_file("MAIN_HEADER", "templates/mainHeader.html"); if ($client->isRegistered()) { //$template -> assign_file("USER_MENU", "../templates/userMenu.html"); /***** Получение наименования области видимости *****/ $template->assign("USER_VISIBILITY_AREA", $client->getVisibilityAreaTilte()); /***** Получение фио пользователя *****/ $template->assign("USER_FIO", $client->getFio()); /***** Парсинг элемента меню - ДИТ *****/ if ($client->getOblVidId() != 4) { $template->parse("main.menu.dit"); } /***** Парсинг элемента меню - Автотранспорт *****/ //if ($client -> isAutoVisible()) $template->parse("main.menu.auto"); $template->parse("main.menu.newHelp"); //*** Парсинг элемента меню - Закупки ***
/** * Override of parent assign_file method * * @access public * @param string $name Variable to assign $val to * @param string / array $val Values to assign to $name */ public function assign_file($name, $val = '') { if (!$this->_template_is_cached) { parent::assign_file($name, $val); } }
<?php /** * example 7 * demonstrates file includes * * @package XTemplate_Examples * @author Barnabas Debreceni [cranx@users.sourceforge.net] * @copyright Barnabas Debreceni 2000-2001 * @author Jeremy Coates [cocomp@users.sourceforge.net] * @copyright Jeremy Coates 2002-2007 * @see license.txt LGPL / BSD license * @link $HeadURL: https://xtpl.svn.sourceforge.net/svnroot/xtpl/trunk/ex7.php $ * @version $Id: ex7.php 16 2007-01-11 03:02:49Z cocomp $ */ include_once './xtemplate.class.php'; $xtpl = new XTemplate('ex7.xtpl'); $xtpl->assign('FILENAME', 'ex7-inc.xtpl'); // Language is set to English $xtpl->assign_file('LANGUAGE', 'ex7-inc-eng.xtpl'); // Uncomment the line below to set language to German //$xtpl->assign_file('LANGUAGE', 'ex7-inc-de.xtpl'); $xtpl->rparse('main.inc'); $xtpl->parse('main'); $xtpl->out('main');
function panorama() { global $template; global $client; $template = new XTemplate("../templates/index.html"); $template->assign_file("MAIN_HEADER", "../templates/mainHeader.html"); if ($client->isRegistered()) { //$template -> assign_file("USER_MENU", "../templates/userMenu.html"); /***** Получение наименования области видимости *****/ $template->assign("USER_VISIBILITY_AREA", $client->getVisibilityAreaTilte()); /***** Получение фио пользователя *****/ $template->assign("USER_FIO", $client->getFio()); /***** Парсинг элемента меню - ДИТ *****/ $template->parse("main.menu.dit"); /***** Парсинг элемента меню - Автотранспорт *****/ //if ($client -> isAutoVisible()) $template->parse("main.menu.auto"); //*** Парсинг элемента меню - Закупки *** //if ($client -> isZakupkiVisible()) $template -> parse("main.menu.zakupki"); //*** Парсинг элемента меню - Админка *****/ //if ($client -> isAdministrator()) $template -> parse("main.menu.admin"); } if ($client->isRegistered()) { $template->assign_file("USER_MENU", "templates/userMenu.html"); //$template -> assign_file("CONTENT", "../templates/login.html"); } else { $template->assign_file("USER_MENU", "templates/userMenu_unregistered.html"); } $template->assign_file("CONTENT", "../templates/auto/panorama.html"); $template->assign("BODY_ID", "at"); }
function Render() { $this->RunController(); $tpl = new XTemplate($this->mainTemplate); $tpl->assign_file("HEADER_TEMPLATE", $this->headerTemplate); $tpl->assign_file("FOOTER_TEMPLATE", $this->footerTemplate); $tpl->assign_array("MAIN.HEADER", $this->HeaderCode()); $tpl->assign_array("MAIN.FOOTER", $this->FooterCode()); if (count($this->data) > 0) { $tpl->assign_array("MAIN", $this->data); } else { $tpl->assign("MAIN_HEADER", $this->pageHeader); $tpl->parse("MAIN"); } header("Content-Type: text/html; charset=utf-8"); $tpl->out("MAIN"); $this->Close(); }