오빠야

최근글 중 특정 게시판의 원하는 게시물만 나타내기

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;
}
|

댓글 1개

자게에서도 봤는데, 함수선언부에 ' $options="wr_type5" ' 는 필요없지 않나요? ^^;
내부적으로 $options 변수 값에 따라서 다른 쿼리를 날리는 것도 아닌것 같고요..

-- 이전 댓글이 주제넘는 것 같아서 수정했습니다. ^^; 너그럽게 봐주세요. --
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
12년 전 조회 1.9만
12년 전 조회 5,405
12년 전 조회 5,351
12년 전 조회 5,278
12년 전 조회 5,561
12년 전 조회 1.1만
12년 전 조회 1.1만
12년 전 조회 3,069
12년 전 조회 2.4만
12년 전 조회 5,185
12년 전 조회 5,287
12년 전 조회 3,764
12년 전 조회 7,284
12년 전 조회 4,201
12년 전 조회 4,499
12년 전 조회 4,534
12년 전 조회 2,657
12년 전 조회 9,818
12년 전 조회 2.2만
12년 전 조회 6,178
🐛 버그신고