Re: [SMARTY] More complex table
| From: | Monte Ohrt | Date: | Mon, 08 Dec 2003 14:55:42 +0000 |
| Subject: | Re: [SMARTY] More complex table | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10647@lists.php.net to get a copy of this message | ||
There is no good way of handling this with html_table, and IMHO
formatting the content is out of the scope of html_table anyways. Use
the manual method of table generation, and format your data within the
loops.
http://smarty.php.net/contribs/examples/dynamic_table_columns/table.tpl.txt
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=1266
On Sat, 2003-12-06 at 11:39, Janos Rusiczki wrote:
> Hello,
>
> Say, I have the following data:
>
> $pic_fn = array('1.jpg', '2.jpg', '3'.jpg');
> $pic_desc = array('me', 'jack', 'george');
> $pic_info = array('1024 x 768', '800 x 600', '640 x 480');
>
> I would like to generate a table. If I use 'html_table' I can use the
> following:
>
> {html_table loop=$pic_fn cols=2 table_attr='border="0"'}
>
> resulting in:
>
> <table border="0">
> <tr><td>1.jpg</td><td>2.jpg</td></tr>
> </tr><td>3.jpg</td><td> </td></tr>
> </table>
>
> However I'd like to get something more complex, namely (from the data
> I presented above):
>
> <table border="0">
> <tr>
> <td><img src="1.jpg" alt="me"><br />info: 1024 x
> 768</td>
> <td><img src="2.jpg" alt="jack"><br />info: 800 x
> 600</td>
> </tr>
> <tr>
> <td><img src="3.jpg" alt="george"><br />info: 640 x
> 480</td>
> <td> </td>
> </tr>
> </table>
>
> I think it would be a good ideea to extend 'html_table'-s
> functionality to include ways of dealing with these kinds of
> situations.
>
> Until then I'm asking for an elegant, template based, solution,
> because I have one but it involves building the whole table in PHP.
> And then, what's the point of using the template engine? :)
>
> Thanks,
> -janos-