i am trying to change this function to show me alternate row color, not alternate column color.
how can i modify this function without remaking it completely and without java-script (it can be made directly)..?
i tried with come css 3 command i found on google
and with examples from here:Code:tr:nth-child(odd) { background-color:#eee; } tr:nth-child(even) { background-color:#fff; }
http://lorenzod8n.wordpress.com/2007/06/02/alternating-row-color-in-htmlcss-with-php/
http://www.experts-exchange.com/Web_..._23003019.html
and more....
and i dind't manage to remake it...
can someone please help me?
thank you in advance!!!
Code:function table($res) { // Columns $cols = explode(",", $site_config["torrenttable_columns"]); $cols = array_map("strtolower", $cols); $cols = array_map("trim", $cols); $colspan = count($cols); // End echo '<table align=center cellpadding="3" cellspacing="0" class="class1" width=99%> <tr >'; foreach ($cols as $col) { switch ($col) { case 'text': echo "<td class=ttable_head>Data I<b></td>"; break; case 'text2': echo "<td class=ttable_head>Data II<b></td>"; break; case 'modif': echo "<td class=ttable_head>Data III<b></td>"; break; } } echo "</tr>"; while ($row = mysql_fetch_assoc($res)) { $id = $row["id"]; print("<tr class=testtabel5>\n"); $x = 1; foreach ($cols as $col) { switch ($col) { case 'text': print("<td align=center>".$row['data1']); break; case 'text2': print("<td class=class2 align=center>".$row['data2']); break; case 'modif': $char1 = 35; //cut name length $smallname =CutName(htmlspecialchars($row["name"]), $char1); $test = $row["data1"]; $dispname = "<b>".$smallname."</b>"; print("<td class=class3 nowrap> <a title=\"".$row["name"]."\" href=\"snow.php?id=$id\">Snows</a>"); break; } if ($x == 2) $x--; else $x++; } print("</tr>\n"); } print("</table><BR>\n"); }



Reply With Quote


Bookmarks