... </div> <!-- no results found --> <div class="jplist-no-results"> <p>No results found</p> </div> </div> <?php $bill_list = $dao->getBills(); foreach ($bill_list as $bill) { $action_date = last_action($bill["bill_id"]); ?> <div class="active"> <p>Active Bills</p> <div class="billimage"><span><?php echo $bill["bill_name"]; ?> </span></div> <div class="lastaction">Last Action: <?php echo $action_date; ?> </div> <div class="billsummary"><?php echo $bill["title"]; ?> </div>
function last_action($current, $indice) { global $forum, $ris; $max = $current['last_action']['date']; $return = $current['last_action']; for ($i = 0; $i < $current['num_figli']; $i++) { $next_id = $ris[$indice + $i + 1]; $next_id = (int) $next_id['id']; $tmp = last_action($forum[$next_id], $indice + $i + 1); if ($tmp['date'] > $max) { $max = $tmp['date']; $return = $tmp; } } return $return; }