최근글 중 특정 게시판의 원하는 게시물만 나타내기
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와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3149 | 12년 전 | 11350 | ||
| 3148 | 12년 전 | 12513 | ||
| 3147 | 12년 전 | 4347 | ||
| 3146 | 12년 전 | 11159 | ||
| 3145 |
takumi22
|
12년 전 | 11254 | |
| 3144 | 12년 전 | 5483 | ||
| 3143 | 12년 전 | 10371 | ||
| 3142 | 12년 전 | 9630 | ||
| 3141 | 12년 전 | 4368 | ||
| 3140 | 12년 전 | 3471 | ||
| 3139 |
adm1n
|
12년 전 | 5266 | |
| 3138 | 12년 전 | 6397 | ||
| 3137 | 12년 전 | 5645 | ||
| 3136 |
izabella
|
12년 전 | 6442 | |
| 3135 |
|
12년 전 | 5889 | |
| 3134 |
|
12년 전 | 5070 | |
| 3133 | 12년 전 | 6602 | ||
| 3132 | 12년 전 | 14646 | ||
| 3131 | 12년 전 | 7375 | ||
| 3130 | 12년 전 | 5399 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기