I would like each item on the menu to be displayed on two rows. The first row will contain a cell with the name of the dish, an empty cell with 100% width and a dotted border at the bottom and finally a cell displaying the price of the dish. The second row should only contain a single cell with a colspan of 3 and contain a description of the dish. Thus each dish will have four cells. To make things even more complicated I would like to assign a class to each of the four cells so I can style them individually.
You can see an example of what I would like you can go to http://rasmusk.wid.ots.dk/projekter/kog ... retter.php where I have made a menu using static HTML.
I've already found out how to generate a HTML-table from a .txt-file but the way the script works is like this: Each line in the .txt file is divided using a delimiter. The code then takes each item on each line and generates a cell from. The only way I've been able to get reasonably near what I want has been to structure the .txt file like this (using ; as delimiter):
Code: Select all
Name of dish; ;price
Description; ; ;
I've used the PHP code found here. My code currently looks like this:
Head section
Code: Select all
<?php
$file = "menukort/supper.txt";
$delimiter = "<>";
@$fp = fopen($file, "r") or die("Could not open file for reading");
while (!feof($fp))
{
$tmpstr = fgets($fp, 100);
$line[] = ereg_replace("\r\n", "", $tmpstr);
}
for ($i=0; $i < count($line); $i++)
{
$line[$i] = split($delimiter, $line[$i]);
}
?>Code: Select all
<table class="menukort">
<?php
for ($i=0; $i < count($line); $i++)
{
echo "<tr>";
for ($j=0; $j < count($line[$i]); $j++)
{
echo "<td>".$line[$i][$j]."</td>";
}
echo "</tr>";
}
fclose($fp);
?>
</table>