ganz praktisch um Designsprengungen zu verhindern
$unamelaenge = 15; # beispielsweise: $linkclass = '6' würde bedeuten: "$CoRpI..." => ganz praktisch um Designsprengungen zu verhindern
$rowclass1 = 'Cnorm'; # beispielsweise: $linkclass = 'Cnorm' würde bedeuten: (1. Zeilenklasse)
| ....... |
$rowclass2 = 'Cmite'; # beispielsweise: $linkclass = 'Cmite' würde bedeuten: (2. Zeilenklasse) | ....... |
$linkclass = ''; # beispielsweise: $linkclass = 'class="box"' würde bedeuten: xyz
$limit = 20; # beispielsweise: $limit = '100' würde bedeuten: in der Tabellenübersicht werden 100 News angezeigt bis eine neue Seite käme
$title = $allgAr['title'].' :: Newsarchiv';
$hmenu = 'Newsarchiv';
$design = new design ( $title , $hmenu );
$design->header();
if (isset($_POST['chcat'])) {
$kat = $_POST['cat'];
}
else $kat = 'showallcats';
$page = ( $menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
if ($menu->getA(2) == 'p') {
$kat = $menu->get(1);
$page = ( $menu->getA(2) == 'p' ? $menu->getE(2) : 1 );
}
$MPL = db_make_sites ($page , "WHERE ".($kat == 'showallcats'?'':"news_kat = BINARY '$kat' AND ")."news_recht >= ".$_SESSION['authright'] , $limit , '?newsarchiv'.($kat == 'showallcats'?'':'-'.$kat) , 'news' );
$anfang = ($page - 1) * $limit;
$abf = "SELECT
a.news_title as title,
a.news_id as id,
DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
DATE_FORMAT(a.news_time,'%W') as dayofweek,
a.news_kat as kate,
a.news_frei as frei,
a.news_text as text,
a.news_tn as tn,
b.name as username,
b.id as uid
FROM prefix_news as a
LEFT JOIN prefix_user as b ON a.user_id = b.id
WHERE ".($kat == 'showallcats'?'':"a.news_kat = BINARY '$kat' AND ")
.$_SESSION['authright']." <= a.news_recht AND a.news_tn = 'true'
ORDER BY news_time DESC
LIMIT $anfang,$limit";
$abf1 = "SELECT
a.news_title as title,
a.news_id as id,
DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
DATE_FORMAT(a.news_time,'%W') as dayofweek,
a.news_kat as kate,
a.news_frei as frei,
a.news_text as text,
a.news_tn as tn,
b.name as username,
b.id as uid
FROM prefix_news as a
LEFT JOIN prefix_user as b ON a.user_id = b.id
WHERE ".($kat == 'showallcats'?'':"a.news_kat = BINARY '$kat' AND ")
.$_SESSION['authright']." <= a.news_recht AND a.news_tn = 'false'
ORDER BY news_time DESC
LIMIT $anfang,$limit";
$tpl = new tpl ( 'newsarchiv.htm' );
$sql = db_query("SELECT DISTINCT news_kat FROM `prefix_news`");
$kats .= '';
$ar = array (
'KATS' => $kats,
'SITELINK' => $MPL
);
$tpl->set_ar_out($ar, 0 );
$erg = db_query($abf);
$i = 0;
while ($row = db_fetch_assoc($erg)) {
$i++;
if($row['frei'] == "true"){
$k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'");
$row['kom'] = db_result($k0m,0);
if ($i % 2 != 0) {
$rowcolorclass = $rowclass1;
}else{
$rowcolorclass = $rowclass2;
}
if(strlen($row['title']) > $titellaenge ){
$row['title'] = substr($row['title'], 0, $titellaenge ).'...';
}
if(strlen($row['username']) > $unamelaenge ){
$row['username'] = substr($row['username'], 0, $unamelaenge ).'...';
}
$ar = array (
'RCC' => $rowcolorclass,
'DATE' => $row['datum'],
'TITLE' => ''.$row['title'].'',
'USERNAME' => ''.$row['username'].'',
'COMMENTS' => '('.$row['kom'].')',
'PRINT' => '
'
);
$tpl->set_ar_out($ar, 1 );
}
}
while ($row = db_fetch_assoc($erg1)) {
$i++;
if($row['frei'] == "true"){
$k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'");
$row['kom'] = db_result($k0m,0);
if ($i % 2 != 0) {
$rowcolorclass = $rowclass1;
}else{
$rowcolorclass = $rowclass2;
}
if(strlen($row['title']) > $titellaenge ){
$row['title'] = substr($row['title'], 0, $titellaenge ).'...';
}
if(strlen($row['username']) > $unamelaenge ){
$row['username'] = substr($row['username'], 0, $unamelaenge ).'...';
}
$ar = array (
'RCC' => $rowcolorclass,
'DATE' => $row['datum'],
'TITLE' => ''.$row['title'].'',
'USERNAME' => ''.$row['username'].'',
'COMMENTS' => '('.$row['kom'].')',
'PRINT' => '
'
);
$tpl->set_ar_out($ar, 1 );
}
}
$tpl->out(2);
unset($tpl);
$design->footer();
?>