최근글 중 특정 게시판의 원하는 게시물만 나타내기
lib/latest.lib.php 파일에
아래 내용을 추가하고 특정 테이블의 특정 필드의 값이 있는 게시물 중 작은 순서로 나타내기 입니다.
// 최신글 추출2
function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="wr_type5") <= 요 부분이요...
$sql = " select * from $tmp_write_table where( wr_is_comment = 0 and wr_type5 > 0 ) order by wr_type5 limit 0, $rows "; <= 요 부분이요...
// 최신글 추출2
function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="wr_type5")
{
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 wr_type5 > 0 ) order by wr_type5 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;
}
아래 내용을 추가하고 특정 테이블의 특정 필드의 값이 있는 게시물 중 작은 순서로 나타내기 입니다.
// 최신글 추출2
function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="wr_type5") <= 요 부분이요...
$sql = " select * from $tmp_write_table where( wr_is_comment = 0 and wr_type5 > 0 ) order by wr_type5 limit 0, $rows "; <= 요 부분이요...
// 최신글 추출2
function latest2($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="wr_type5")
{
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 wr_type5 > 0 ) order by wr_type5 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;
}
댓글 1개
12년 전
자게에서도 봤는데, 함수선언부에 ' $options="wr_type5" ' 는 필요없지 않나요? ^^;
내부적으로 $options 변수 값에 따라서 다른 쿼리를 날리는 것도 아닌것 같고요..
-- 이전 댓글이 주제넘는 것 같아서 수정했습니다. ^^; 너그럽게 봐주세요. --
내부적으로 $options 변수 값에 따라서 다른 쿼리를 날리는 것도 아닌것 같고요..
-- 이전 댓글이 주제넘는 것 같아서 수정했습니다. ^^; 너그럽게 봐주세요. --
게시판 목록
그누4 팁자료실
그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3309 | 3년 전 | 1805 | ||
| 3308 | 11년 전 | 2093 | ||
| 3307 |
uPAmJ903
|
6년 전 | 4752 | |
| 3306 |
바른사나이
|
6년 전 | 3274 | |
| 3305 | 6년 전 | 12312 | ||
| 3304 | 7년 전 | 3705 | ||
| 3303 | 7년 전 | 3744 | ||
| 3302 |
지리산초보
|
7년 전 | 13597 | |
| 3301 |
sozet
|
8년 전 | 4905 | |
| 3300 |
sozet
|
8년 전 | 5974 | |
| 3299 |
sozet
|
8년 전 | 10863 | |
| 3298 | 8년 전 | 4017 | ||
| 3297 |
또치하우스
|
8년 전 | 4444 | |
| 3296 | 8년 전 | 11972 | ||
| 3295 |
또치하우스
|
8년 전 | 14988 | |
| 3294 | 8년 전 | 6028 | ||
| 3293 | 8년 전 | 5592 | ||
| 3292 |
|
9년 전 | 5320 | |
| 3291 | 9년 전 | 13683 | ||
| 3290 | 9년 전 | 5055 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기