The function is this.
<?
function latest_group($skin_dir="", $gr_id, $rows=10, $subject_len=40, $category="", $orderby="")
{
global $config;
global $g4;
$list = array();
$limitrows = $rows;
$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' and bo_use_search=1 order by bo_order_search";
$rsgroup = sql_query($sqlgroup);
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4[write_prefix] . $bo_table;
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? " order by wr_id desc " : " order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {
if(!$orderby) $op_list[$k] = $row[wr_datetime];
else {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}
$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);
$list[$k][bo_table] = $board[bo_table];
$list[$k][bo_subject] = $board[bo_subject];
$list[$k][subject] = cut_str($board[bo_subject] . $list[$k][wr_subject], $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
and html calling this function is
<table width=100% class=box_all><tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5"></td>
<td height="23"><img src=<?=$g4[path]?>/skin/latest/club_latest/img/board_icon1.gif width=16 height=9> <strong><font color=#1749ba>
latest</strong></td>
<td align="right"></td>
<td width="5"></td>
</tr>
<tr>
<td colspan=4 height="1" bgcolor=green width=95%></td>
</tr>
<tr>
<td colspan=4 height="5" ></td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<? //debug
echo "$list1[$key][bo_subject]";
echo "$$list1[$key][href]";
?>
<?
$i=0;
foreach($list1 as $key=>$value) {
if ($i++>=($top1-1)) break;
$list1[$key][bo_subject];
?>
<tr>
<td width="15" height="22" align="center" valign="middle" ><img src="<?=$latest_skin_path?>/img/board_icon.gif" width="9" height="13"></td>
<td style='word-break:break-all;'>
<?
echo $list1[$key][icon_reply] . " ";
//echo "<a href='#' onclick=\"javascript:window.open('{$list1[$key][href]}', '', 'left=150, top=10, width=700, height=500, scrollbars=1');\">";
echo "<a href='{$list1[$key][href]}'>";
echo "<font style='font-family:default; font-size:9pt; color:#6A6A6A;'>{$list1[$key][subject]}</font>";
echo "</a>";
?>
</td>
</tr>
<tr><td colspan="2" height="1" background="<?=$g4[path]?>/bbs/img/dot_bg.gif"></td></tr>
<? } ?>
</td>
</tr></table>
</td></tr></table>
Any comment would be appreciated.