我想从文件中打印一个表格,这样非极客群体可以在没有我帮助的情况下轻松更新表格。问题是我希望表格的第一行为每列打印不同的工具提示。我如何在 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>";
?>
解决它。
从 php 中拉出表格和第一行,它们不需要在那里,现在我可以按照我想要的方式将工具提示放在图像上。
感谢大家的建议!:)