최신글 자동 출력시 일부게시판이나 특정그룹게시판 제외하기 정보
최신글 자동 출력시 일부게시판이나 특정그룹게시판 제외하기본문
그누 최상위에 있는 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");
?>
최신글 출력중 특정그룹이나 일부 게시판을 제외하고 싶은데
여기저기 찾다가
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");
?>
댓글 전체
자문자답
<?
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");
?>
<?
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");
?>