Jason,
You could use a table to display your information. Tables shouldn't be
used strictly for layout purposes, but if the data makes sense to use
a table, use a table.
Having said that, the php to display this isn't to difficult.
My code below is going to based on an assumption of the data in a
similar format.
<?php
$manufacturers = array(
"name"=>"Sample Company",
"models"=>array(
array(
"number"=>"model 1 number",
"description"=>"model 1 description"
),
array(
"number"=>"model 2 number",
"description"=>"model 2 description"
)
)
)
?>
It I wanted to use a table, then to display the data, I would use
something like the following code:
<?php
echo '<table>';
echo '<tr><th>Manufacturer</th><th>Model</th><th>Description</th></tr>'
foreach($manufacturers as $manufacturer) {
echo '<tr><td colspan="3">'.$manufacturer['name'].'</td></tr>';
foreach($manufacturer['models'] as $model) {
echo '<tr><td> </td><a href="page.php?model='.
$model['number'].'">'.$model['number'].'</a><td></td><td>'.
$model['description'].'</td></tr>';
}
}
echo '</table>'
?>
This will create a table with the first line being the table header,
then for each manufacturer, display 1 row with the manufacturer name
and then as many rows as necessary to display the model number and
description.
Alternatively, if you really wanted to display this information in
without tables, you could use the similar code:
<?php
foreach($manufacturers as $manufacturer) {
echo '<div class="manufacturer_row">';
echo '<div class="manufacturer_name">'.$manufacturer['name'].'</tdiv>';
foreach($manufacturer['models'] as $model) {
echo '<div class="model_row">';
echo <div class="model_number"><a href="page.php?model='.
$model['number'].'">'.$model['number'].'</a></div>';
echo <div
class="model_description">'.$model['description'].'</div>';
echo '</div>';
}
echo '</div>';
}
?>
Then for the CSS, I would use
<style type="text/css">
.manufacturer_row {
clear: both;
}
.model_row {
clear: both;
}
.model_number, .model_description {
float: left;
width: 200px;
}
</style>
This should give you the desired effect to display tabular like data
without using tables. This does have some draw backs. For instance, to
get the data to line up correctly, you need to designate the width of
the divs.
Any other styling could be done any way that you want.
Hopefully this get you started. For additional information on the
foreach loop that I use, http://us3.php.net/foreach
On Mar 5, 2008, at 3:40 AM, Jason Crosse wrote:
On 05/03/2008 06:16, Sherry Myrow wrote:
Logistically it's really simple. I need to create a page that
displays a
bunch of data. I have a huge list of manufacturers and a long list
of model
numbers. I need to be able to extract the manufacturer name from
the
database and display that on screen (so it can be dynamic). Then
underneath
the Manufacturer name i want to show every single model number
(again pulled
from the database). Each model number should be clickable to a
page that
shows the corresponding product list for that specific manufacturer
and
model number.
...
Can anyone point me in the right direction? URLs to a good
tutorial or page
that explains how to integrate php with css and html would be soooo
apreciated. I'm finding many articles on line about creating navs
and entire
home pages but nothing as simple as what I need.
To me, it sounds like you should use a table: it's tabular data
after all, isn't it?
As for php, that's off-list but you can make a start here:
http://www.w3schools.com/php/default.asp
--
http://antanova.blogspot.com
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/