G4 최신글을 검색어별로 추출하고 싶습니다 정보
G4 최신글을 검색어별로 추출하고 싶습니다본문
g4 이용잡니다.
한 게시판에 수록된 최신글을
검색어별로 추출하여 한 화면에 동시에
2개의 게시판으로 배치하고 싶습니다.
직업으로 검색한 게시판 1개
취업으로 검색한 게시판 1개
------------------------
참고로 제가 사용하는 게시판은 다음과 같습니다.
게시판 명은 ez_me
스킨명은 basic
분류는 청년층, 중년층, 노년층 3개로 되어 있습니다.
배치코자 하는 검색 단어는 취업, 직업 2개입니다.
취업게시판 1개
직업게시판 1개
-----------------------
원래의 index.php에서 어디를 고쳐야 합니까?
원래의 latest.lib.php에서는 어디를 고쳐야 합니까?
고수님들의 조언 부탁드립니다.
꾸벅
-----------------
-----------------
index.php 원래 상황
-----------------
<?
// 상대 경로
$g4_path = ".";
include_once("$g4_path/common.php");
include_once("$g4[path]/lib/latest.lib.php");
$g4[title] = "";
include_once("$g4[path]/head.php");
?>
<!-- 메인화면 최신글 시작 -->
<table width="100%" cellpadding=0 cellspacing=0><tr><td valign=top>
<?
// 최신글
$sql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
// 스킨은 입력하지 않을 경우 관리자 > 환경설정의 최신글 스킨경로를 기본 스킨으로 합니다.
// 사용방법
// latest(스킨, 게시판아이디, 출력라인, 글자수);
echo latest("basic", $row[bo_table], 5, 70);
echo "<p>\n";
}
?>
</td></tr></table>
<!-- 메인화면 최신글 끝 -->
<?
include_once("$g4[path]/tail.php");
?>
---------------------
latest.lib.php 원래 상황
---------------------
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$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 order by wr_id desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
------------------------------
댓글 전체
g4/bbs/search.php를 바탕으로 해서
함수 하나를 만들어야겠네요.
간단한 방법으로는 latest()가 들어 갈 자리마다 iframe 걸고
그 안에 g4/bbs/search.php를 넣는 것입니다.