Re: [SMARTY] give smarty tpl file a php associative array?

From: Date: Fri, 02 May 2003 03:57:06 +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-9442@lists.php.net to get a copy of this message
Try: $smarty=new smarty; $smarty->assign("member",array()); // Note the quotes... $smarty->display(index.tpl); cheers, Travis Prince wrote:
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...
-- Travis Low <mailto:travis@dawnstar.com> <http://www.dawnstar.com>

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