# sortierung festlegen
$sortierung = 'pos ASC';
$DOM = 'ASC';
$POM = 'ASC';
$DAM = 'ASC';
switch ($menu->get(2)) {
case 'positionDESC' : $sortierung = 'pos DESC'; break;
case 'positionASC' : $sortierung = 'pos ASC'; $POM = 'DESC'; break;
case 'downsDESC' : $sortierung = 'downs DESC'; break;
case 'downsASC' : $sortierung = 'downs ASC'; $DOM = 'DESC'; break;
case 'dateDESC' : $sortierung = 'time DESC'; break;
case 'dateASC' : $sortierung = 'time ASC'; $DAM = 'DESC'; break;
}
$tpl->set ('POM', $POM);
$tpl->set ('DOM', $DOM);
$tpl->set ('DAM', $DAM);
$limit = 20; // Limit
$page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1);
$MPL = db_make_sites ($page , "WHERE cat = " . $cid . "" , $limit , "?downloads-" . $cid . "" , 'downloads');
$anfang = ($page - 1) * $limit;
$erg = db_query("select id,name,version,ssurl,`desc`,downs,DATE_FORMAT(time,'%d.%m.%Y') as datum from prefix_downloads WHERE cat = " . $cid . " ORDER BY " . $sortierung . " LIMIT $anfang,$limit");
if (db_num_rows($erg) > 0) {
$tpl->out(4);
echo '<div align="center">' . $MPL . '<br><br></div>';
$class = 'Cnorm';
while ($row = db_fetch_assoc($erg)) {
// smal screenshot url
$row['ssurl'] = ((file_exists($row['ssurl']) AND $row['ssurl'] != '') ? '<img src="' . $row['ssurl'] . '" alt="' . $row['name'] . ' ' . $row['version'] . '" title="' . $row['name'] . ' ' . $row['version'] . '" style="float:left; border: none; padding-right:3px;" />' : '');
$class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite');
$row['class'] = $class;
$tpl->set_ar_out($row, 5);
}
$tpl->out(6);
echo '<div align="center"><br>' . $MPL . '</div>';