PHP-Code:
<?
require("config.inc.php");
if ($_GET['action']=='articles') {
echo "<table border='0' cellpadding='3' cellspacing='1' width='100%'>
<tr>
<td width='32%' height='$theight' bgcolor='$tcolor1'>
<b>Title</b>
</td>
<td width='32%' align='center' height='$theight' bgcolor='$tcolor1'>
<b>Type</b>
</td>
<td width='32%' align='center' height='$theight' bgcolor='$tcolor1'>
<b>Date</b>
</td>
</tr>";
$result = mysql_query("SELECT * FROM $tab_art ORDER BY id DESC");
$i=1;
while ($article = mysql_fetch_array($result)) {
if (($i%2)==0)
echo "<tr bgcolor='$tcolor2' height='$theight'>";
else
echo "<tr bgcolor='$tcolor3' height='$theight'>";
$i++;
echo "<td width='50%' height='$theight'><a href='?action=articles&id=$article[id]'>$article[titel]</a></td>
<td width='30%' align='center' height='$theight'><a href='?action=articles&type=$article[catid]&id=$article[id]'>$article[catid]</a></td>
<td width='20%' align='center' height='$theight'>".date("d.m.Y, H:i",$article[time])."</tr></td>"; }
echo "</table><br>";
}
elseif ($_GET['action']=='articles' and $_GET['type']=='$article[catid]' and isset($_GET['id'])) {
echo "<table border='0' cellpadding='3' cellspacing='1' width='100%'>
<tr>
<td width='32%' height='$theight' bgcolor='$tcolor1'>
<b>Title</b>
</td>
<td width='32%' align='center' height='$theight' bgcolor='$tcolor1'>
<b>Type</b>
</td>
<td width='32%' align='center' height='$theight' bgcolor='$tcolor1'>
<b>Date</b>
</td>
</tr>";
$result = mysql_query("SELECT * FROM $tab_art WHERE catid='$article[catid]' ORDER BY id DESC");
$i=1;
while ($article = mysql_fetch_array($result)) {
if (($i%2)==0)
echo "<tr bgcolor='$tcolor2' height='$theight'>";
else
echo "<tr bgcolor='$tcolor3' height='$theight'>";
$i++;
echo "<td width='50%' height='$theight'><a href='?action=articles&id=$article[id]'>$article[titel]</a></td>
<td width='30%' align='center' height='$theight'><a href='?action=articles&type=$article[catid]&id=$article[id]'>$article[catid]</a></td>
<td width='20%' align='center' height='$theight'>".date("d.m.Y, H:i",$article[time])."</tr></td>"; }
echo "</table><br>";
}
?>
Kommentar