최신글에 특정 카테고리만 나타내기

어떤 게시판에 여러 카테고리를 가지고 있다면 그중 하나의 카테고리에 있는 최신글만을 추출하는 방법 알고 싶습니다.
|

댓글 5개

최신글 스킨의 latest.skin.php에서

$ca_name = $list[$i][ca_name];
for 문 시작..
if($ca_name == "카타고리명") {
기타 등등 내용....
}
for 문 끝..

요런식으로 하면될듯 싶어요.
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=52445
이미 정확히 만들어진 결과물을 드려도 없다시면...
어찌 하오리까?
질문자의 질문에 대한 정확한 답일터인데...
원하는 답을 얻지 못했네요..
대신 extend/developer.lib.php에 다음의 함수를 넣어서

// 특정 카테고리 최신글 추출
function new_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 ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name ='원하는 카테고리명' 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;
}

최신글 불러올때 new_latest("","", 5, 20);형식으로 해서 만들었답니다.

도움주신 분들에게 감사합니다.
참 닉네임을 바꾸어서.... 답변자 소리틀이 질문자인 노아아빠입니다...
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
18년 전 조회 1,725
18년 전 조회 1,660
18년 전 조회 1,515
18년 전 조회 1,208
18년 전 조회 1,481
18년 전 조회 1,526
18년 전 조회 2,077
18년 전 조회 1,515
18년 전 조회 1,593
18년 전 조회 1,660
18년 전 조회 1,716
18년 전 조회 1,601
18년 전 조회 1,614
18년 전 조회 1,304
18년 전 조회 1,306
18년 전 조회 1,741
18년 전 조회 1,569
18년 전 조회 1,425
18년 전 조회 1,599
18년 전 조회 1,491
🐛 버그신고