i valori che estraggo tipo departname departid io, ho fatto cosi:
Codice PHP:
function ViewDeparment(){
global $dbcore;
$sql = mysql_query("select * from depart order by displayorder asc ")or die (mysql_error());
$resultdepart = mysql_fetch_array($sql);
foreach($resultdepart as $key=>$val)
return $resultdepart ;
}
e cosi passo la funzione a smarty
Codice PHP:
if(ViewDeparment()){
$smarty->assign("result" , true);
$departmetval = ViewDeparment();
$smarty->assign("departarray" ,$departmetval);
}else{
$smarty->assign("result" , false);
}
e cosi ho fatto il template
codice:
<{if $result ==true }>
<{foreach name=nome item=row from=$departarray}>
<tr onMouseOver="javascript:this.className='navitemhover';" onMouseOut="javascript:this.className='navitem';" >
<td class="rcwcol2" style="width: 1%;height:24px;">
<{if $row.enabled }>
[img]<{$path_helpdesk}>/template/admin_default/images/icone_mini/ico_deoarton.gif[/img]
<{else}>
[img]<{$path_helpdesk}>/template/admin_default/images/icone_mini/ico_deoartoff.gif[/img]
<{/if}>
</td>
<td class="rcwcol2" style="width: 69%;height:24px;"><{$row.departname}> </td>
<td class="rcwcol2" style="width: 10%;height:24px;text-align: center;"><{$row.enabled}> </td>
<td class="rcwcol2" style="width: 15%;height: 24px;text-align:center;"> </td>
</tr>
<{/foreach}>
<{else}>
<tr>
<td class="rcwcol2" style="width: 1%;height:24px;"></td>
<td class="rcwcol2" style="width: 69%;height:24px;">Non e presente nessun Dipartimento</td>
<td class="rcwcol2" style="width: 10%;height:24px;text-align: center;"></td>
<td class="rcwcol2" style="width: 15%;height: 24px;text-align:center;"></td>
</tr>
<{/if}>