Make use of CSS for table design
authorJoey Schulze <joey@infodrom.org>
Sat, 30 Aug 2008 22:40:30 +0000 (22:40 +0000)
committerJoey Schulze <joey@infodrom.org>
Sat, 30 Aug 2008 22:40:30 +0000 (22:40 +0000)
src/LTOL/news/index.wml

index 6a375b6..66fbf7c 100644 (file)
@@ -4,9 +4,8 @@
 
 <define-tag th endtag=required><*th>%body<*/th></define-tag>
 
-#<table border=0 cellspacing=3 bgcolor="#f7ba2e">
-<table width=100% border=0 cellspacing=0 cellpadding=1>
-<tr bgcolor=#<colh>><th>Nr.</th><th>Autor</th><th>Titel</th><th>Datum</th></tr>
+<table class="border smallfont" width=100% border=0 cellspacing=0 cellpadding=1>
+<tr class=head><th>Nr.</th><th>Autor</th><th>Titel</th><th>Datum</th></tr>
 
 <?
   $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
   $query = "SELECT id,subject,author,releasedate,deleted FROM news ORDER BY releasedate DESC,insertd DESC";
   $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");
 
-  $color = "<cold>";
+  $color = 0;
   for ($nr=0; $nr < pg_NumRows ($sth); $nr++) {
     $row = pg_fetch_array ($sth, $nr);
     $date = explode (" ", $row['releasedate']);
     $date = explode ("-", $date[0]);
     $date = sprintf ("%d.%d.%d", $date[2], $date[1], $date[0]);
-    $color = $color == "<cold>"?"<coln>":"<cold>";
 
-    printf ("<tr bgcolor=\"#%s\"><td>%d</td>", $color, $nr+1);
+    printf ("<tr class=\"t%d\"><td>%d</td>", $color, $nr+1);
     if ($row['deleted'] == 1) {
       $del = " (del)";
     } else {
     }
     printf ("<td>%s</td><td><a href=\"edit.php?id=%d\">%s</a>%s</td><td align=\"right\">%s</td></td></tr>",
           $row['author'], $row['id'], $row['subject'], $del, $date);
+    $color = !$color;
   }
 ?>
 
 </table>
 
+<p>&nbsp;</p>
+
 </page>
 
 # Local variables: