최신글 특정단어만 출력방법좀 부탁드립니다

최신글 특정단어만 출력방법좀 부탁드립니다

QA

최신글 특정단어만 출력방법좀 부탁드립니다

본문

아래 소스를 적용하면 카테고리까지만 검색이되는되요 

카테고리에 특정단어 [예] 그누보드 검색까지되게 할수있나요 

 

if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
     global $g4;
     
     $a = explode("|", $bo_table);
     $bo_table = $a[0];
     $ca_name = $a[1];
     
     $latest_skin_path = "$g4[path]/skin/latest";
     $latest_skin_path .= $skin_dir ? "/$skin_dir" : "/basic";
     
     $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
     $board = sql_fetch($sql);
     
     $tmp_write_table = $g4['write_prefix'].$bo_table;
     $where = "where wr_is_comment=0";
     if ($ca_name) $where .= " and ca_name='$ca_name'";
     $sql = " select * from $tmp_write_table $where order by wr_num limit 0, $rows ";
     
     $result = sql_query($sql);
     $list = array();
     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;
}

/* 사용 예
include("$g4[path]/lib/latest.lib.php");
echo latest("basic", "community|freeboard", 10); // 보드명|카테고리명
// echo latest("basic", "community", 10); // 카테고리 없이 사용

카테고리별 최신글 요청이 많아서 따로 함수를 만들어 썼었는데
latest.lib.php를 조금만 수정하면 쉽게 구현이 가능하더군요.
위 소스를 lib/latest.lib.php에 덮어씌우면 됩니다

 

그누 소스를 건들기 찜찜하신 분들은

lib/latest2.lib.php로 저장하고
latest.lib.php대신 latest2.lib.php를 인클루드 해서 쓰면 되겠죠.

include("$g4[path]/lib/latest2.lib.php");
echo latest("basic", "community|freeboard", 10);
*/

 

 

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 123,592 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT