Re: [SMARTY] A better way to create a table based on the number of elements
| From: | Monte Ohrt | Date: | Tue, 25 Feb 2003 19:55:51 +0000 |
| Subject: | Re: [SMARTY] A better way to create a table based on the number of elements | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8197@lists.php.net to get a copy of this message | ||
In CVS there is a new plugin called html_table, you might be able to
start with that. It expects a numbered array though.
$data = array ('foo','bar','blah');
{html_table loop=$data cols=2}
Monte
On Tue, 2003-02-25 at 17:56, jun wrote:
> 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
--
Monte Ohrt <monte@ispi.net>