{section name=com loop=$comm}
{$comm[com].body}
{/section}
$comment=mysql_fetch_array(mysql_query("select * from comment where idn=$id"));
$theme ->assign("comm",$comment);
$result=mysql_query("select * from comment where idn=$id");
$arr=array();
$num=0;
while( $comment=mysql_fetch_array($result))
{
$arr['id'][$num]=$comment[0];
$arr['name'][$num]=$comment[1];
}
$theme ->assign("comm",$arr['id']);
$theme ->assign("name",$arr['id']);
{section name=com loop=$id}
{$id[com]} : {$name[com]} </br>
{/section}
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
class poll
{
function get_all_poll()
{
$query="select * from poll ";
$num=0;
$result=db_query($query);
$return_array=array();
while ($row=db_fetch_array($result)) {
$return_array[$num]['PollID']=$row[0];
$return_array[$num]['PollQuestion']=$row[1];
$return_array[$num]['PollDate']=$row[1];
$return_array[$num]['LangaugeName']=$row[4];
$num++;
}
return $return_array;
}
}
$polls=poll::get_all_poll();
$smarty->assign('POLLS',$polls);
$smarty->display('poll.tpl');
<table width="100%" border="0" class="datagrid" id="PollList">
<thead>
<td>سوال</td>
<td>تاریخ</td>
<td>زبان</td>
</thead>
{section name=polls loop=$POLLS}
{if %polls.index% is odd by 1}
<tr>
{else}
<tr style="background-color:#eee">
{/if}
<td >{$POLLS[polls].PollQuestion}</td>
<td>{$POLLS[polls].PollDate}</td>
<td >{$POLLS[polls].LangaugeName}</td>
</tr>
{sectionelse}
نظرسنجی موجود نمی باشد
{/section}
</table>