CODE
<?php
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('/usr/local/lib/php/Smarty/templates');
$smarty->setCompileDir('/usr/local/lib/php/Smarty/templates_c');
$smarty->setCacheDir('/usr/local/lib/php/Smarty/cache');
$smarty->setConfigDir('/usr/local/lib/php/Smarty/config');
$smarty->assign('id_filmu', $id_filmu);
$smarty->display('templ_smart.html');
#$smarty->testInstall();
$polaczenie = @mysql_connect("localhost" , "wojtek" , "wojtek")
or die ("Nie mozna nawiazac polaczenia z baza danych");
$wybor = @mysql_select_db("filmy")
or die("Nie mozna wybrac bazy");
$zapytanie = "SELECT * FROM film";
$wynik = mysql_query($zapytanie) or die ("Query Filed");
$id_filmu = array();
while ($row = mysql_fetch_array($wynik))
{
$id_filmu[]=$row;
}
?>
require('/usr/local/lib/php/Smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir('/usr/local/lib/php/Smarty/templates');
$smarty->setCompileDir('/usr/local/lib/php/Smarty/templates_c');
$smarty->setCacheDir('/usr/local/lib/php/Smarty/cache');
$smarty->setConfigDir('/usr/local/lib/php/Smarty/config');
$smarty->assign('id_filmu', $id_filmu);
$smarty->display('templ_smart.html');
#$smarty->testInstall();
$polaczenie = @mysql_connect("localhost" , "wojtek" , "wojtek")
or die ("Nie mozna nawiazac polaczenia z baza danych");
$wybor = @mysql_select_db("filmy")
or die("Nie mozna wybrac bazy");
$zapytanie = "SELECT * FROM film";
$wynik = mysql_query($zapytanie) or die ("Query Filed");
$id_filmu = array();
while ($row = mysql_fetch_array($wynik))
{
$id_filmu[]=$row;
}
?>
CODE
<html>
<head><TITLE>stosowanie smarty</TITLE>
</head>
<body>
<table border=1 width=100% cellspacing=0 cellpadding=4>
<th style="background: #666">Tytul</th><th style="background: #666">Gatunek</th><th style="background: #666">Rok produkcji</th>
<th style="background: #666">Wypozyczony</th>
{section name=spis loop=$id_filmu}
<tr>
<td width="50%">{$id_filmu[spis].tytul}</td>';
<td width="25%">{$id_filmu[spis].gatunek}</td>';
<td width="15%">{$id_filmu[spis].rok_prod}</td>';
<td width="10%">{$id_filmu[spis].wypozycz}</td>';
</tr>
{/section}
</table>
<p>1 - wypozyczony; 0 - nie wypozyczony</p>
</body>
</html>
<head><TITLE>stosowanie smarty</TITLE>
</head>
<body>
<table border=1 width=100% cellspacing=0 cellpadding=4>
<th style="background: #666">Tytul</th><th style="background: #666">Gatunek</th><th style="background: #666">Rok produkcji</th>
<th style="background: #666">Wypozyczony</th>
{section name=spis loop=$id_filmu}
<tr>
<td width="50%">{$id_filmu[spis].tytul}</td>';
<td width="25%">{$id_filmu[spis].gatunek}</td>';
<td width="15%">{$id_filmu[spis].rok_prod}</td>';
<td width="10%">{$id_filmu[spis].wypozycz}</td>';
</tr>
{/section}
</table>
<p>1 - wypozyczony; 0 - nie wypozyczony</p>
</body>
</html>