give smarty tpl file a php associative array?
| From: | Prince | Date: | Fri, 02 May 2003 04:05:57 +0000 |
| Subject: | give smarty tpl file a php associative array? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-9441@lists.php.net to get a copy of this message | ||
hi
have been trying to get this problem fixed for a while now but still dont know quite how to fix
it...
i have an array: $member
its assigned in the index.php file of the template file by doing a mysql query to get all members in
an array:
<?php
mysql_connect($host, $mysqluser, $mysqlpwd)||
die(mysql_error());
mysql_select_db($db)||die(mysql_error());
$query=mysql_query("select * from members");
while($member=mysql_fetch_array($query)){
//not sure what to do here since php gives me an associative
//array already
}
$smarty=new smarty;
$smarty->assign($member,array());//i think but not sure...
$smarty->display(index.tpl);
?>
now in index.tpl:
<body>
{section name=member_show loop=$member}
{$member.company}
{$member.address1}
{*so on through the loop*}
{/section}
how should i fix this so it works? keep getting parse error on it...