So ich hab das nicht getestet, hoffe aber es ohne Fehler hinbekommen zu haben.
<?php
# Copyright by: Michael Riedel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
# Allgemeine Variablen
$titellaenge = 35; # beispielsweise: $titellaenge = '12' würde bedeuten: "Neues Counte..." => ganz praktisch um Designsprengungen zu verhindern
$unamelaenge = 20; # beispielsweise: $linkclass = '6' würde bedeuten: "$CoRpI..." => ganz praktisch um Designsprengungen zu verhindern
$rowclass1 = 'Cnorm'; # beispielsweise: $linkclass = 'Cnorm' würde bedeuten: (1. Zeilenklasse) <tr class="Cnorm"><td>.......</td></tr>
$rowclass2 = 'Cmite'; # beispielsweise: $linkclass = 'Cmite' würde bedeuten: (2. Zeilenklasse) <tr class="Cnorm"><td>.......</td></tr>
$linkclass = ''; # beispielsweise: $linkclass = 'class="box"' würde bedeuten: <a class="box" href="xyz">xyz</a>
$limit = 50; # beispielsweise: $limit = '100' würde bedeuten: in der Tabellenübersicht werden 100 News angezeigt bis eine neue Seite käme
$newskat = $menu->get(1);
$title = $allgAr['title'].' :: Newsliste';
$hmenu = 'News - '.$newskat;
$design = new design ( $title , $hmenu );
$design->header();
$page = ( $menu->getA(2) == 'p' ? $menu->getE(2) : 1 );
$MPL = db_make_sites ($page , "WHERE ( news_recht >= ".$_SESSION['authright']." )", $limit , '?katnews-'.$newskat , 'news' );
$anfang = ($page - 1) * $limit;
$abf = "SELECT
a.news_title as title,
a.news_id as id,
a.news_kat as kategorie,
DATE_FORMAT(a.news_time,'%d.%m.%Y') as datum,
b.name as username,
a.user_id as userid
FROM prefix_news as a
LEFT JOIN prefix_user as b ON a.user_id = b.id
WHERE ((".$_SESSION['authright']." <= a.news_recht) OR ( a.news_recht = 0 ))
ORDER BY news_kat, news_time DESC
LIMIT ".$anfang.",".$limit;
$tpl = new tpl ( 'katnews.htm' );
$ar = array (
'SITELINK' => $MPL
);
$tpl->set_ar_out($ar, 0 );
$erg = db_query($abf);
$i = 0;
$oldNewsKat = false;
while ($row = db_fetch_assoc($erg)) {
$newskat = $row->news_kat;
if ($newskat != $oldNewsKat) {
$oldNewsKat = $newskat;
$ar = array (
'NEWSKAT' => $newskat,
'KATPIC' => '<img src="include/images/news/'.$newskat.'.jpg" alt="'.$newskat.'" />',
);
$tpl->set_ar_out($ar, 1);
}
$i++;
$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' => '<a '.$linkclass.' href="?news-'.$row['id'].'">'.$row['title'].'</a>',
'USERNAME' => '<a '.$linkclass.' href="?user-details-'.$row['userid'].'">'.$row['username'].'</a>',
'COMMENTS' => '<a '.$linkclass.' href="?news-'.$row['id'].'">('.$row['kom'].')'
);
$tpl->set_ar_out($ar, 2 );
}
$tpl->out(3);
unset($tpl);
$design->footer();
?>
<table cellpadding="3" cellspacing="1" border="0" width="100%" class="border">
{EXPLODE}
<tr class="Chead">
<td colspan="4"><b>{NEWSKAT}</b></td>
</tr>
<tr class="Cnorm">
<td colspan="4" align="center">{KATPIC}</td>
</tr>
<tr class="Chead">
<td width="20%">Datum</td>
<td width="40%">Titel</td>
<td width="20%">Autorname</td>
<td width="20%">Kommentare</td>
</tr>
{EXPLODE}
<tr class="{RCC}">
<td align="left">{DATE}</td>
<td align="left">{TITLE}</td>
<td align="left">{USERNAME}</td>
<td align="right">{COMMENTS}</td>
</tr>
{EXPLODE}
</table>
<div align="center">{SITELINK}</div>