그누보드4-최신 글 가져오는 코드 /index.php
<?
$m_bo_table = 'news';
$m_rows = "5";
$m_subject_len = 20;
$m_latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$m_bo_table'";
$board = sql_fetch($sql);
//echo "$sql<br />";
$tmp_write_table = $g4['write_prefix'] . $m_bo_table; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $m_rows ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $m_rows ";
//echo "$sql<br />";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $m_latest_skin_path, $m_subject_len);
?>
<? for ($i=0; $i<count($list); $i++) { ?>
<? echo "<img src='$m_latest_skin_path/img/latest_icon.gif' align=absmiddle>"; ?>
<?
// 파일 출력
/*
for ($j=0; $j<=count($list[$i][file]); $j++) {
if ($list[$i][file][$j][view])
echo $list[$i][file][$j][view] . "<p>";
}
*/
if ($list[$i][file][0][view])
echo "<img src='$g4[path]/data/file/$m_bo_table/{$list[$i][file][0][file]}' align='absmiddle' width='100' height='60' />";
?>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
echo "<br />";
?>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>