PHP コードを使用して .csv テーブルからコンテンツを取得する html テーブルを生成しています。
今、私はすべての特定のセルのフォーマットがその内容に依存することを望みます。
疑似コードでの私の(おそらくひどい)試み:
if (cell content == "green")
use #green-css-style
if else (cell content == "blue")
use #blue-css-style
等々。
限られた量の異なるコンテンツ(約5)を「聞く」だけにしたい。
これは私のPHPテーブルジェネレーターです:
<?php
$hasTitle = true;
echo '<table id="dataTable" class="table">';
$handle = fopen("data.csv", "r");
$start = 0;
;
while (($data = fgetcsv($handle, 1000, ";")) !== FALSE)
{
echo '<tr>' . "\n";
for ( $x = 0; $x < count($data); $x++)
{
if ($start == 0 && $hasTitle == true)
echo '<th title="ignore_case">'.$data[$x].'</th>' . "\n";
else
echo '<td>'.$data[$x].'</td>' . "\n";
}
$start++;
echo '</tr>' . "\n";
}
fclose($handle);
;
echo '</table>' . '<br style="clear: both;">';
?>
これに関するヘルプは大歓迎です。リクエストに応じて追加の詳細を入手できます。:)