View Full Version : Displaying differing variables using a set table layout

Jay Vincent
01-23-2004, 08:49 PM
Hey people,
OK, what I need to do is have a page of the products with each product in a table layout. The table layout is shown in $layout.
How can I make it so that in $layout the values of $product is product[1], then product[2], and if I added a product[3] it will be displayed in another table?


$description[1]="An awesome shoe.";

$product[2]="Osiris 2";
$description[2]="An awesome shoe 2.";

$layout="<table cellspacing=0 cellpadding=0 border=0><tr><td rowspan=3><img src=".$image." width=150 height=100></td><td><b>".$product." </b></td></tr><tr><td>".$description."</td></tr><tr><td>".$price."</td></tr></table><p>";


- I know this code isn't correct and won't work, but I thought I'd post it so its easier to see what I mean.

Thanks for any help

Jay Vincent

01-23-2004, 09:08 PM
have you tried a "for" loop? i don't really understand yor question.

Jay Vincent
01-23-2004, 09:18 PM
Yeah I can't explain it very well, lol sorry. I'll try again :)

What I want is a page of products, where each product is displayed in a table, and each product is one above the other.


this shows the layout with just one product. The coding for that was:

$description1="An awesome shoe.";

$layout="<table cellspacing=0 cellpadding=0 border=0><tr><td rowspan=3><img src=".$image1." width=150 height=100></td><td><b>".$product1." </b></td></tr><tr><td>".$description1."</td></tr><tr><td>".$price1."</td></tr></table><p>";


Do you see that if I then add $product2, $price2, $description2 and $image2 I would need to add another $layout with all the variables changed.
I was asking if there was a solution so I don't have to add more $layout's for every new product.

Hope that makes more sense!