인덱스 페이지에 최신글 출력하는 화면인데 정보
인덱스 페이지에 최신글 출력하는 화면인데
본문
최신글을 스킨없이 사용하여 개별 페이지로 만든다음
인덱스에 불러올 수 있도록 하였습니다.
문제는 검색 체크를 뺀 게시판에 올린글도 출력이됩니다.
검색 체크가 적용되어 회원들이 못보게 할 순 없는건가요?
무조건 등록하는 글은 첫하면에 다 나와버리니 불편한 점이 많습니다.
어느 부분을 수정해야할지...
--===========================================================================-
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가(특정페이지에 include시키는 경우만 출력시켜 줌)
include_once("./_common.php");
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가(특정페이지에 include시키는 경우만 출력시켜 줌)
include_once("./_common.php");
$g4['title'] = "최근 게시물";
?>
<table width="391" border="0" cellspacing="0" cellpadding="0" style="margin-top:7px;">
<tr>
<td colspan="2"><img src="./img/new_top.gif" alt=""></td>
</tr>
<tr>
<td valign="top" style="background:url(./img/new_bg.gif) repeat-y; width:70px;"><a href="/bbs/new.php" onfocus='this.blur();'><img src="./img/new_title.gif" alt=""></a></td>
<td style="background:url(./img/new_bg.gif) repeat-y right top; vertical-align:top;">
?>
<table width="391" border="0" cellspacing="0" cellpadding="0" style="margin-top:7px;">
<tr>
<td colspan="2"><img src="./img/new_top.gif" alt=""></td>
</tr>
<tr>
<td valign="top" style="background:url(./img/new_bg.gif) repeat-y; width:70px;"><a href="/bbs/new.php" onfocus='this.blur();'><img src="./img/new_title.gif" alt=""></a></td>
<td style="background:url(./img/new_bg.gif) repeat-y right top; vertical-align:top;">
<?
$new_count = 9;//출력될 목록 수
$cnt = 0;
$sql = " select bo_table, wr_parent from $g4[board_new_table] a
where a.wr_id = a.wr_parent
group by bo_table, wr_parent
order by bn_id desc
limit $new_count ";
$res = sql_query($sql);
for ($i=0; $row=sql_fetch_array($res), $i<$new_count; $i++)
{
if (!$row[bo_table])
{
continue;
}
{
if (!$row[bo_table])
{
continue;
}
$tmp_table = $g4[write_prefix].$row[bo_table];
$sql2 = " select wr_subject, wr_comment from $tmp_table where wr_id = '$row[wr_parent]' ";
$row2 = sql_fetch($sql2);
$subj = get_text($row2[wr_subject]);
$comment = "";
if ($row2[wr_comment])
$comment = "<span class=small>($row2[wr_comment])</span>";
$sql2 = " select wr_subject, wr_comment from $tmp_table where wr_id = '$row[wr_parent]' ";
$row2 = sql_fetch($sql2);
$subj = get_text($row2[wr_subject]);
$comment = "";
if ($row2[wr_comment])
$comment = "<span class=small>($row2[wr_comment])</span>";
echo "<nobr style='display:block;overflow:hidden;width:280px;'>"; //추출되는 제목의 길이를 제어
echo "<img src=$g4[path]/img/t.gif height=5>";
echo "<br>";
echo " <img src=$g4[path]/img/icon_red_01.gif border=0>";
echo " <a href='$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row[wr_parent]'>";
echo "<img src=$g4[path]/img/t.gif height=5>";
echo "<br>";
echo " <img src=$g4[path]/img/icon_red_01.gif border=0>";
echo " <a href='$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row[wr_parent]'>";
if ($comment) {
echo "<span style='color:#666666;'> $comment $subj</span></a>";//코멘트 있을 경우 출력
//} else if ($comcol) {
} else {
echo "<span style='color:#666666;'> $subj</span></a>";//코멘트 없을 경우 출력
}
echo "<br>";
echo "<img src=$g4[path]/img/t.gif height=2>";
echo "<br>";
echo "<img src=$g4[path]/img/bg7.gif height=1 width=295>";
echo "</nobr>";
$cnt++;
}
if (!$cnt)
echo "게시글이 없습니다.";
echo "<span style='color:#666666;'> $comment $subj</span></a>";//코멘트 있을 경우 출력
//} else if ($comcol) {
} else {
echo "<span style='color:#666666;'> $subj</span></a>";//코멘트 없을 경우 출력
}
echo "<br>";
echo "<img src=$g4[path]/img/t.gif height=2>";
echo "<br>";
echo "<img src=$g4[path]/img/bg7.gif height=1 width=295>";
echo "</nobr>";
$cnt++;
}
if (!$cnt)
echo "게시글이 없습니다.";
?>
</td>
</tr>
<tr>
<td colspan="2"><img src="./img/new_bottom.gif" alt=""></td>
</tr>
<tr><td colspan="2" height=5></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><img src="./img/new_bottom.gif" alt=""></td>
</tr>
<tr><td colspan="2" height=5></td>
</tr>
</table>
댓글 전체
//////몇개만 제외시킬 경우
//////////원본 수정:제외될 게시판을 몇개 정해서 최신글에서 출력을 제외함
$exclude="request";
$exclude3="fishing";
$exclude4="climbing";
$exclude2="schedule"; //제외될 게시판...&&으로 연결함 게시판 아이디를 넣으면 됨
$sql = " select bo_table, bo_subject from $g4[board_table] where (bo_table <> '$exclude')&&(bo_table <> '$exclude2')&&(bo_table <> '$exclude3')&&(bo_table <> '$exclude4') order by gr_id, bo_table ";
/////////원본에서 수정한 부분끝/////////////
$result = sql_query($sql);
이런 식으로 하면 제외되던데요..
//////////원본 수정:제외될 게시판을 몇개 정해서 최신글에서 출력을 제외함
$exclude="request";
$exclude3="fishing";
$exclude4="climbing";
$exclude2="schedule"; //제외될 게시판...&&으로 연결함 게시판 아이디를 넣으면 됨
$sql = " select bo_table, bo_subject from $g4[board_table] where (bo_table <> '$exclude')&&(bo_table <> '$exclude2')&&(bo_table <> '$exclude3')&&(bo_table <> '$exclude4') order by gr_id, bo_table ";
/////////원본에서 수정한 부분끝/////////////
$result = sql_query($sql);
이런 식으로 하면 제외되던데요..

안되네요 ㅡㅡ;
그누보드 원본 index.php파일에 있는 내용중에 중간에 끼워서 넣은건데요 ...
$sql="select bo_table, bo_subject from $g4[board_table] where (bo_table <> '제외될 게시판명') order by gr_id, bo_table";
요렇게 해서 실제로 생성된 게시판 중에서 하나를 해보세요.
where (bo_table <> '제외될 게시판명') <----요것이 제외시키는 조건입니다요.
$sql="select bo_table, bo_subject from $g4[board_table] where (bo_table <> '제외될 게시판명') order by gr_id, bo_table";
요렇게 해서 실제로 생성된 게시판 중에서 하나를 해보세요.
where (bo_table <> '제외될 게시판명') <----요것이 제외시키는 조건입니다요.