Ok dann teste mal das
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Daten</title>
<style type="text/css">
<!--
body {
margin:0px;
background:#ffffff;
font-size:10px;
font-family:Arial, Helvetica, sans-serif;
}
.presse {
width:500px;
margin:5px;
float:left;
padding:3px;
background-color:#EEEEEE;
border:1px solid #CCCCCC;
font-size: 11px;
font-family: Verdana;
color: #1e1e1e;
}
a {
font-size: 11px;
font-family: Verdana;
color: #1e1e1e;
text-decoration: none;
}
.presse_ansicht {
width:500px;
margin:5px;
float:left;
padding:3px;
background-color:#ffffff;
border:1px solid #CCCCCC;
font-size: 11px;
font-family: Verdana;
color: #1e1e1e;
}
.presse_jahr_ansicht {
float:left;
width:450px;
margin:1px;
padding:2px;
background-color:#ffffff;
border:1px solid #CCCCCC;
font-size: 11px;
font-family: Verdana;
color: #1e1e1e;
}
-->
</style>
</head>
<body>
<?php
require_once('db.Class.php');
$tabellenname = "presse";
$dbhost = " ";
$dbuser = " ";
$dbpass = " ";
$dbname = " ";
$db = new DB($dbhost, $dbuser, $dbpass, $dbname);
switch($_REQUEST['do'])
{
case 'read' :
echo '<div class="presse_ansicht">';
if ( is_numeric($_REQUEST['id']) ) {
$id = escape($_REQUEST['id']);
$abf = "SELECT text, title, date
FROM $tabellenname
WHERE id = '".$id."'";
$erg = $db->Query($abf);
$row = $erg->fetchrow();
if ($erg->NumRows() > 0) {
echo '<b>'.$row->title.'</b>('.$row->date.')<br />'.$row->text;
} else {
echo 'Kein eintrag gefunden !'."\n";
}
} else {
echo 'ID ist keine Zahl!'."\n";
}
echo '</div>';
break;
case 'years' :
$years = array('2006','2007','2008'); # Jahre
foreach($years as $yid){
echo '<div class="presse_jahr_ansicht">'."\n";
echo '<h2>'.$yid.'</h2>';
$abf = 'SELECT id, title, DATE_FORMAT(date,"%Y") as date, DATE_FORMAT(date,"%d.%m.%Y") as anzeigedatum
FROM '.$tabellenname.'';
$erg = $db->Query($abf);
while ($row = $erg->FetchAssocArray()) {
if ($row['date'] == $yid ) {
echo $row['anzeigedatum'].'<b> <a href="index.php?do=read&id='.$row['id'].'">'.$row['title'].'</a></b><br />'."\n";
}
}
echo '</div>'."\n";
}
break;
default :
echo '<div class="presse">'."\n";
$abf = 'SELECT id, title, date
FROM '.$tabellenname.'
ORDER BY date DESC
LIMIT 0,30';
$erg = $db->Query($abf);
while ($row = $erg->FetchAssocArray()) {
echo '<div style=\"width:100px; float:left;\">'.$row['date'].'</div><div style="float:left;"><b><a href="index.php?do=read&id='.$row['id'].'">'.$row['title'].'</a></b><div>'."\n";
}
echo '</div>'."\n";
break;
}
?>
</body>
</html>
Du kannst die Jahre die er anzeigen soll auch anpassen. Einfach nach $years suchen und editieren
Aufrufen tust du die Seite über index.php?do=years und die Zeit speichere ich in NOW() also ( zb. 2008-05-11 01:34:17 )
MfG OloX
Zuletzt modifiziert von OloX am 22.10.2008 - 20:46:16