agilityweb Posted February 26, 2012 Share Posted February 26, 2012 hello what i want to do is to display tickets in supporttickets.php in a separate table per department. so rather 1 table as is currently with all tickets and separate one for department 1 , 2 etc i was hoping to amend the foreach to pull in only from a single depat then replicate the table i have a department called General support and one called product support i tried {foreach key=num item=ticket from=$tickets where $ticket.department='General Support'} however i dont even get an error message any ideas? 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted February 26, 2012 Share Posted February 26, 2012 You're probably best off pulling the tickets into a PHP block and parsing them into a new array thats keyed by the department. Maybe something like this. (untested) {php} $alltickets = $this->_tpl_vars['tickets']; $ticketsout = array(); foreach ($alltickets as $key => $val) { $dept = $val['department']; $ticketsout[$dept][] = $val; } $this->_tpl_vars['modifiedtickets'] = $ticketsout; {/php} Then parse the array in smarty like this. {foreach key=dept from=$modifiedtickets item=t} <h3>{$dept}</h3> <table> {foreach key=num from=$t item=ticket} <tr> <td>{$ticket.subject}</td> <td>etc</td> </tr> {/foreach} </table> <br /> {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.