set_file(array('news' => 'news.tpl', 'row' => 'news_row.tpl') ); $db->query("SELECT COUNT(*) FROM phpgw_news WHERE news_status='Active'"); $db->next_record(); $total = $db->f(0); if (! $oldnews) { $db->query("SELECT *,account_lid AS submittedby FROM phpgw_news,phpgw_accounts WHERE news_status='Active' " . "AND news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 5"); } else { $db->query("SELECT *,account_lid AS submittedby FROM phpgw_news,phpgw_accounts WHERE news_status='Active' AND " . "news_submittedby=phpgw_accounts.account_id ORDER BY news_date DESC LIMIT 5,$total"); } while ($db->next_record()) { $tpl->set_var('subject',$db->f('news_subject')); $tpl->set_var('submitedby','Submitted by ' . $db->f('submittedby') . ' on ' . date("m/d/Y - h:m:s a",$db->f('news_date'))); $tpl->set_var('content',nl2br($db->f('news_content'))); $tpl->parse('rows','row',True); } $tpl->pparse('out','news'); if ($total > 5 && ! $oldnews) { echo '