More complex table

From: Date: Sat, 06 Dec 2003 17:39:03 +0000
Subject: More complex table
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10643@lists.php.net to get a copy of this message
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>&nbsp;</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>&nbsp;</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-

« previous php.smarty.general (#10643) next »