help with design
| From: | Andy B | Date: | Thu, 16 Oct 2003 00:22:53 +0000 |
| Subject: | help with design | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10356@lists.php.net to get a copy of this message | ||
hi...
im trying to decide whether or not to let the html page/template writer of the project im doing have
control over loops or should i do it in my code.
the project is a system where you have members of a group pulled from a mysql db and listed on a
page. each record is put inside a table of its own and the code should loop through the db printing
out all of the members records as well as reprinting a template table for the next record. i.e.
example in normal php code i would use is:
//connect to db
mysql_connect($host, $mysqluser, $mysqlpwd)||die("server is dead");
$result=mysql_query("select * from wata.members");
//now set a loop to go through all the records and show them in a table
while($member=mysql_fetch_array($result)){
<table>
//print table here with variable content
</table>
}
the next part i dont really know about is making seperate functions for each element of a members
record i.e. wata_company or should i just do an array...like above without the table for printout...
so i would have:
//all the mysql_connect stuff here....
$result=mysql_query("select * from wata.members");
while($member=mysql_fetch_array($result))
$smarty=new smarty;
//assign values now to template that uses this function:
smarty->assign("Wata_Company_name",$member[company]);
//go through the list (about 35 different ones listed
i just know how to write the code for my idea right now....can anybody help??
tnx