Simple table from array

From: Date: Thu, 23 Oct 2003 21:58:47 +0000
Subject: Simple table from array
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10411@lists.php.net to get a copy of this message
Hello everyone I've got the following: $smarty->assign('topic',array( array('topic_code' => '1', 'topic_name' => 'name1'), array('topic_code' => '2', 'topic_name' => 'name2'), array('topic_code' => '3', 'topic_name' => 'name3'), array('topic_code' => '4', 'topic_name' => 'name4') ) ); And I want to get this result: <table width="100%" border="0" cellspacing="0"> <tr> <td><a href="code1">name1</a></td> </tr> <tr> <td><a href="code2">name2</a></td> </tr> <tr> <td><a href="code3">name3</a></td> </tr> <tr> <td><a href="code4">name4</a></td> </tr> </table> I've tried this (as shown in the manual). I know it doesn't add the link, I'll work it out later on: {foreach name=outer item=topic from=$topic} {foreach key=key item=item from=$topic} {$key}:{$item}<br> {/foreach} {/foreach} But keep getting this: 0:Array 1:Array 2:Array 3:Array 0:Array 1:Array 2:Array 3:Array 0:Array 1:Array 2:Array 3:Array 0:Array 1:Array 2:Array 3:Array So, does anyone have any idea of what I'm doing wrong? Thanks a lot. ******************************************************* Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105962 University of Antioquia Medellín - Colombia 2002 *******************************************************

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