A better way to create a table based on the number of elements
| From: | jun | Date: | Tue, 25 Feb 2003 23:56:05 +0000 |
| Subject: | A better way to create a table based on the number of elements | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8176@lists.php.net to get a copy of this message | ||
Hi! I'm creating a simple online photo-album using PHP and Smarty. Yes,
after some convincing to myself that Smarty is easy.. .I have done it. But,
I have questions regarding generating tables with variable Table Data <TD>
What I wanted to do is to create a table Like ( i hope my message will show
up in correct format).
My Family Picture
____________________
| | |
| | |
| img 1 | img 2 |
| | |
|---------+----------|
| | |
| img 3 | img 4 |
+---------+----------+
| | |
| img 5 | |
+---------+----------+
The above figure is what I want my script to generate thru Smarty.
What I do is I pass an associative array called $Pictrures
$Pictrures[0][pic_id] = 1;
$Pictrures[0][pic_title] = "Title 1";
$Pictrures[0][pic_desc] = "Description of Pic 1";
$Pictrures[0][pic_id] = 2;
$Pictrures[0][pic_title] = "Title 2";
$Pictrures[0][pic_desc] = "Description of Pic 2";
$Pictrures[0][pic_id] = 3;
$Pictrures[0][pic_title] = "Title 3";
$Pictrures[0][pic_desc] = "Description of Pic 3";
$Pictrures[0][pic_id] = 4;
$Pictrures[0][pic_title] = "Title 4";
$Pictrures[0][pic_desc] = "Description of Pic 4";
$Pictrures[0][pic_id] = 5;
$Pictrures[0][pic_title] = "Title 5";
$Pictrures[0][pic_desc] = "Description of Pic 5";
How can I use Smarty to produce an output where all images are listed
from LEFT TO RIGHT, TOP TO BOTTOM as shown in the above figure. What
happens if the number of elements of $Pictures is an ODD number.. that
means, I have one empty TABLE DATA <TD> on the right part of the table.
I hope that my question will have an answer soon.. More power to alll
Smarty is great! Show me more :-)
jun
--
-------------------------------------
its never enough