%NAVIGATION%
";
include("db_layer.php");
require_once("util.php");
function PrintNav()
{global $db,$c;
$res = mysql_query("SELECT cid,name FROM ".$db["table_cats"]." ORDER BY ordr") or die(mysql_error());
while (list($cid,$name)=mysql_fetch_row($res))
{ if (!isset($c)) $c=$cid;
echo "";
if ($c!=$cid) echo "";
echo $name;
if ($c!=$cid) echo "";
echo "";
};
};
function PrintGal()
{global $db,$c,$GALLERY,$images_dir;
$gallery="";
$navigation=
"
« 1 »
";
$res=mysql_query("SELECT item_id,name,short_descr,smallimagetype from ".$db["table_items"].
" WHERE cid='".$c."'") or die(mysql_error());
$i=0;
while ($item=mysql_fetch_row($res))
{
$items[$i]=$item;
$i++;
};
$total=$i;
if ($total==0) return;
while ($i!=0)
{ $num_line="";
$name_line="";
$img_line="";
$comm_line="";
for ($k=0;($k<3)&&($i!=0);$k++,$i--)
{
$curr=$total-$i;
$name_line.="".($curr+1)." | ".stripslashes($items[$curr][1])." | \n";
$img_line.=" | \n";
$comm_line.="".stripslashes($items[$curr][2])." | \n";
// echo $items[$curr][2]." ";
}
$gallery.="\n".$name_line."
\n\n".$img_line."
\n\n".$comm_line."
\n"." |
\n";
/* echo "\n";
echo $name_line;
echo "
\n\n";
echo $img_line;
echo "
\n\n";
echo $comm_line;
echo "
\n";
echo " |
\n";*/;
};
$temp=str_replace("%GALLERY%",$gallery,$GALLERY);
$temp=str_replace("%NAVIGATION%",$navigation,$temp);
echo $temp;
};
include("gallery.tmpl");
?>