테스트 사이트 - 개발 중인 베타 버전입니다

최신글 자동 출력시 일부게시판이나 특정그룹게시판 제외하기

· 15년 전 · 1662 · 1
인사.gif
그누 최상위에 있는 index.php에서
최신글 출력중 특정그룹이나 일부 게시판을 제외하고 싶은데
여기저기 찾다가

http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=133376

에서처럼

$sql = " select bo_table, bo_subject from $g4[board_table]
where gr_id = '$gr_id'
and bo_table not in ('qna', 'free') 조건 추가하세요.
and bo_list_level <= '$member[mb_level]'
order by bo_table ";

적용해보면 index.php에서는 에러가 나는데요.
아래 index.php 소스에 적용할려면 어떻게 해야 할까요?





<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");

$g4['title'] = "";
include_once("./_head.php");
?>

<!-- 메인화면 최신글 시작 -->
<table width="740" cellpadding=0 cellspacing=1>

<? // 최신글
$sql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
$result = sql_query($sql);
$k=0;
echo "<tr valign='top'>";
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$k=$k+1;
echo "<td width=50%>";
echo latest('basic', $row[bo_table], 5, 45);
echo "</td>";
if($k==2) {echo "</tr><tr valign='top'>"; $k=0;}
}
?>
</tr>

</table>
<!-- 메인화면 최신글 끝 -->

<?
include_once("./_tail.php");
?>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 1개

자문자답
<?
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");

$g4[title] = "";
include_once("./_head.php");
?>

<!-- 메인화면 최신글 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<?
// 게시판 목록을 읽어서 최근글을 읽어온다.
$sql = " select bo_table, bo_subject from $g4[board_table] where bo_table not in ('제외게시판1', '제외게시판2') order by gr_id, bo_table ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result);) {
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
// 스킨은 입력하지 않을 경우 관리자 > 환경설정의 최신글 스킨경로를 기본 스킨으로 합니다.
// 사용방법
// 아래 %1이면 1열, %3이면 3열이 됩니다.
// latest(스킨, 게시판아이디, 출력라인, 글자수)
if($i%2==0)
echo "<tr>";
?>
<td width="50%" valign="top">
<?= latest('basic', $row[bo_table], 5, 45)?>
</td>
<?
$i++;
}
?>
</tr></table>
<!-- 메인화면 최신글 끝 -->
<?
include_once("./_tail.php");
?>

게시글 목록

번호 제목
284044
284041
284040
284034
284033
284029
284024
284015
284011
284010
284009
283998
283992
283989
283984
283983
283981
283976
283974
283966