Hilfe zur Zeilenformatierung

  • Hilfe zur Zeilenformatierung

    Hallo liebe Gemeinde,

    ich suche nach rat um folgendes Problem. Ich habe eine Tabelle die aus einer Datenbank ausgelesen wird. Diese färbt jede 2. Zeile in einem anderen Farbton ein. Funktioniert auch wunderbar im IE, Opera...aber im FF gibt er mir die Hintergundfarben nicht aus wenn ich die Tabelle in eine bestehende Seite einbinde (nur im FF).

    Anhang noch dazu. wenn ich die grundformatierung der Hauptseite weglasse, gehts trotzdem nicht :(

    Schau ich mir die Tabelle im FF alleinstehend an, funktiert das mit den Farben. Natürlich dachte ich, hab ich in der Haupseit irgendwo eine Formatierung drin, die mir das dann im FF zerschiesst. Finde dort aber nichts, was das beeinflssen könnte. Daher meine Frage an Euch, kann man es vom Script her besser schreiben, das das mit den Farben 100% funktioniert?

    Oder hab ich irgendwo nen total dummen Fehler drin....wäre ja auch nix neues :)

    Der Link zur Seite: Link

    Hier der PHP-Code:

    Quellcode

    1. <?php
    2. $SQL_host = 'xxx';
    3. $SQL_db = 'xxx';
    4. $SQL_user = 'xxx';
    5. $SQL_pw = 'xxx';
    6. $filename = "tpl.html";
    7. $handle = fopen ($filename, "r");
    8. $buffer = fread ($handle, filesize ($filename));
    9. fclose ($handle);
    10. $template = $buffer;
    11. //Mit Datenbank verbinden
    12. $link = mysql_connect ($SQL_host, $SQL_user, $SQL_pw);
    13. mysql_select_db ($SQL_db);
    14. $query = "SELECT * FROM f1_saison ORDER BY punkte DESC";
    15. $result = mysql_query ($query);
    16. $i = 0;
    17. $switch = 0;
    18. while($output = mysql_fetch_object($result))
    19. {
    20. $i++;
    21. $template2 .= $template;
    22. if ($switch == 0)
    23. {
    24. $template2 = str_replace('$$color$$', "e0e0e0", $template2);
    25. $switch = 1;
    26. }
    27. else
    28. {
    29. $template2 = str_replace('$$color$$', "f9f9f9", $template2);
    30. $switch = 0;
    31. }
    32. $template2 = str_replace('$$position$$', $i, $template2);
    33. $template2 = str_replace('$$name$$', $output->name, $template2);
    34. $template2 = str_replace('$$team$$', $output->team, $template2);
    35. $template2 = str_replace('$$rennen$$', $output->rennen, $template2);
    36. $template2 = str_replace('$$punkte$$', $output->punkte, $template2);
    37. }
    38. echo '<table>';
    39. echo '<tr class="head" background="#474747"><td class="pos">pos</td><td class="fahrer" style="color: #e0e0e0; font-weight: normal"">fahrer</td><td class="team" style="color: #e0e0e0">team</td><td class="spiele">races</td><td class="spiele">pkt</td></tr>';
    40. echo '</table>';
    41. echo $template2;
    42. ?>
    Alles anzeigen


    Das Template:

    Quellcode

    1. <table bgcolor="$$color$$">
    2. <tr>
    3. <td class="pos" >$$position$$</td>
    4. <td class="fahrer">$$name$$</td>
    5. <td class="team">$$team$$</td>
    6. <td class="spiele">$$rennen$$</td>
    7. <td class="spiele">$$punkte$$</td>
    8. </tr>
    9. </table>


    Und das CSS:

    Quellcode

    1. table {
    2. width: 455px;
    3. font-size: 12px;
    4. font-family: verdana, arial, sans-serif;
    5. font-variant: small-caps;
    6. }
    7. td {
    8. font-size: 12px;
    9. height: 17px;
    10. border: 0;
    11. padding: 2px 3px 1px 3px;
    12. }
    13. .head {
    14. background: #474747;
    15. color: #e0e0e0;
    16. height: 20px;
    17. }
    18. .pos {
    19. text-align: right;
    20. width: 35px;
    21. font-weight: bold;
    22. }
    23. .fahrer {
    24. text-align: left;
    25. width: 155px;
    26. color: #474747;
    27. font-weight: bold;
    28. }
    29. .team {
    30. text-align: left;
    31. width: 155px;
    32. color: #474747;
    33. }
    34. .spiele {
    35. text-align: right;
    36. width: 40px;
    37. }
    Alles anzeigen



    Danke!
  • okay, selbst gelöst, der firefox brauchte folgende änderung:

    voher:

    Quellcode

    1. {
    2. $template2 = str_replace('$$color$$', "e0e0e0", $template2);
    3. $switch = 1;
    4. }
    5. else
    6. {
    7. $template2 = str_replace('$$color$$', "f9f9f9", $template2);
    8. $switch = 0;
    9. }


    nachher:

    Quellcode

    1. {
    2. $template2 = str_replace('$$color$$', "#e0e0e0", $template2);
    3. $switch = 1;
    4. }
    5. else
    6. {
    7. $template2 = str_replace('$$color$$', "#f9f9f9", $template2);
    8. $switch = 0;
    9. }



    immer diese Kleinigkeiten*lol