Код:
<?php
ob_start();
session_start();
define('IN_VALID', true);
include 'connect.php';
include 'template.php';
include 'functions.php';
$template = new Template('template');
$template->set_filenames(array(
"index" => "index.tpl"
));
$sql = "SELECT name FROM an_active_style";
$res = mysql_query($sql);
$row = mysql_fetch_object($res);
$active_style = $row->name;
$sql1 = "SELECT name, id FROM an_pages";
$res1 = mysql_query($sql1);
while($row1 = mysql_fetch_object($res1)) {
$page_name = $row1->name;
$page_id = $row->id;
}
$template->assign_vars(array(
"TITLE_SITE" => "Antipatrul site system",
"THEME" => "default",
"BODY_TABLE" => "1000",
"ALIGN" => "center",
"AN-STYLE" => $active_style,
"MENU" => $page_name
));
$template->pparse('index');
$template->set_filenames(array(
"/index" => "endindex.tpl"
));
if ($_SESSION['log_in']) {
$template->assign_vars(array(
"LOG_IN" => "
[ <a href=\"user_cp.php\">Промени профил</a> ]
[ <a href=\"user_cp.php?action=logout\">Излез</a> ]
"
));
} else {
$template->assign_vars(array(
"LOG_IN" => "
<form action=\"user_cp.php?action=login\" method=\"POST\">
Потребител: <input type=\"text\" name=\"username\" value=\"\" class=\"login\">
Парола: <input type=\"text\" name=\"password\" value=\"\" class=\"login\">
<input type=\"submit\" name=\"submit\" value=\"ВХОД\">
<a href=\"user_cp.php?action=register\">Регистрация</a>
</form>"
));
}
$template->pparse('/index');
?>
Това е index.tpl
Код:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link href="styles/{AN-STYLE}/style.css" type="text/css" rel="stylesheet">
<title>{TITLE_SITE}</title>
</head>
<body>
<table width="{BODY_TABLE}" align="{ALIGN}" class="body-table">
<tr>
<td width="250">
{MENU}
</td>
<td width="500">
</td>
<td width="250">