Re: [SMARTY] give smarty tpl file a php associative array?
| From: | Ben | Date: | Fri, 02 May 2003 05:05:07 +0000 |
| Subject: | Re: [SMARTY] give smarty tpl file a php associative array? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9443@lists.php.net to get a copy of this message | ||
Hi,
maybe there is an error in your section (template).
mustn't it be
{section name=member_show loop=$member}
{$member[member].company}
or $loop_var[name].arrayname
greetz
Ben
>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...
>
>
>
>
>---
>__________________________________________________________
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.476 / Virus Database: 273 - Release Date: 24.04.2003