<?php
$page = (!empty($_GET["pn"])) ? intval($_GET["pn"]) : 1;
$totalQuery = @mysql_db_query(_DB,"SELECT id FROM "._TBL_NEWS);
$total = @mysql_num_rows($totalQuery);
$query = @mysql_db_query(_DB,"SELECT * FROM "._TBL_NEWS." ORDER BY -id LIMIT ".(($page-1)*9).", 9");
$count = @mysql_num_rows($query);
if($count == 0 && $total > 0) {
$page = 1;
$query = @mysql_db_query(_DB,"SELECT * FROM "._TBL_NEWS." ORDER BY -id LIMIT ".(($page-1)*9).", 9");
$count = @mysql_num_rows($query);
}
if($count > 0) {
echo "<news total=\"".$total."\">";
while($row = mysql_fetch_row($query)) {
$i = $row[0];
$t = $row[1];
$s = $row[2];
$l = $row[3];
$d = parseDate($row[4]);
$p = $row[5];
echo "<new>";
echo "<i>".$i."</i>"; // id
echo "<t><![CDATA[".$t."]]></t>"; // title
echo "<s><![CDATA[".$s."]]></s>"; // short text
echo "<l><![CDATA[".$l."]]></l>"; // long text
echo "<d><![CDATA[".$d."]]></d>"; // date
echo "<p><![CDATA[".$uploaded."/".$p."]]></p>"; // photo
echo "</new>";
}
echo "</news>";
} else {
echo "X";
}
?>