ファイルからテーブルを印刷したいので、オタクでないコホートが私の助けなしにテーブルを簡単に更新できるようにします。問題は、テーブルの一番上の行を列ごとに異なるツールチップで印刷することです。PHPでこれを行うにはどうすればよいですか、それとももっと良い方法がありますか?
echo "<tr><th>Date Available From (TOOLTIP) </th><th> Photo (TOOLTIP)</th><th> Age (TOOLTIP)</th><th> Breed (TOOLTIP)</th>
<?php
$tdcount = 1; $numtd = 13; // number of cells per row
print "<table class='hovertable'>";
print "<tr><th colspan=13><h1>AVAILABLE HORSES</h1></th></tr>";
echo "<tr><th>Date Available From </th><th>Photo</th><th>Age</th><th>Breed</th><th>Gender</th><th>Height</th><th>Colour</th><th>Price</th><th>Bred</th><th>Training</th><th>Known soundess illness injuries</th><th>Description</th><th>Status</th></tr>";
$f = fopen("available.txt", "r") or die("can't open file");
while (!feof($f)) {
$arrM = explode(",",fgets($f));
$row = current ( $arrM );
if ($tdcount == 1)
print "<tr onmouseover=\"this.style.backgroundColor='#f9ce68';\" onmouseout=\"this.style.backgroundColor='#d4e3e5';\">"; print "<td>$row </td>";
if ($tdcount == $numtd) {
print "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
print "<td> </td>"; $tdcount++;
} print "</tr>";
}
print "</table>";
?>
修正しました。
テーブルと最初の th 行を php から引き出しました。それらはそこにある必要はありませんでした。今では、必要なように th の画像にツール ヒントを挿入するのに問題はありません。
皆さんの提案に感謝します!:)