분류별 최신글 뽑기
본문
<?php echo latest("basic_gallery", "게시판명", 8, 15, "ca_name='예능'");?>
latest.lib.php 파일보면 옵션이란게 있떤데 그 옵션을 ca_name으로 사용하면 안되나요?
답변 2
latest.lib.php 하단에 아래처럼 추가해서 넣거나 파일 새로 만들어서 lib 폴더에 넣고 불러오고..
추출은 이런식으로..
<?php echo latest_category("basic", "free", 5, 25, "", "카테고리명");?>
// 최신글 카테고리별로 추출
function latest_category($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $category="")
{
global $g5;
if (!$skin_dir) $skin_dir = 'basic';
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
$list = array();
$sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";
$board = sql_fetch($sql);
$bo_subject = get_text($board['bo_subject']);
$tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from {$tmp_write_table} where ca_name = '{$category}' order by wr_num limit 0, {$rows} ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
g4 용이라면 참고하세요.
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=11019
http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=24310
답변을 작성하시기 전에 로그인 해주세요.