<?
define("SMARTY_DIR","c:/users/nina/Smarty/libs/");
require(SMARTY_DIR."Smarty.class.php");
$smarty = new Smarty;
$smarty->template_dir = "c:/smarty_dirs/book/templates/";
$smarty->compile_dir = "c:/smarty_dirs/book/templates_c/";
$smarty->config_dir = "c:/smarty_dirs/book/configs/";
$smarty->cache_dir = "c:/smarty_dirs/book/cache/";
// вышеприведенный блок лучше вынести в отдельный файл
$smarty->config_load("task.conf","Database");
$host = $smarty->get_config_vars("host");
$user = $smarty->get_config_vars("user");
$pass = $smarty->get_config_vars("pass");
$db = $smarty->get_config_vars("db");
$conn = mysql_connect($host, $user, $pass) or die("Cant connect");
mysql_select_db($db);
$sql = "SELECT * FROM Articles";
$q = mysql_query($sql,$conn);
$num = mysql_num_rows($q);
for($i=0; $i<$num; $i++){
$title = mysql_result($q,$i,"title");
$author = mysql_result($q,$i,"author");
$abs = mysql_result($q,$i,"abstract");
$full = mysql_result($q,$i,"fulltext");
$smarty->append(array(
title => $title,
author => $author,
abstract => $abs,
fulltext => $full ));
}
$smarty->display("index.tpl");
?>