최신글에서 공지글은 뺄려면 어떻게 해야 하나요?
본문
매인에 최신글이나 페이지에 베스트글 올라가는거에서 공지글은 안올라가게 하고 싶은데 어떻게 해야 하나요?
이제막 그누보드랑 php 공부하는 초보자입니다. 너무 어렵지 않게 고수님들 방법점 알려주세요~
답변 1
같은 초보자로써... 기존소스는 최대한 안바꾸고 하는게 좋다고 생각해요 ㅎㅎ
나중에 참고할때가 꼭 있거등요
이전소스를 복사해서 새로운이름으로 생성하고 사용하는게 좋아요
아래에 소스가 /lib/latest.lib.php 안에 있는 latest라는 펑션을 복사해서 붙여넣고 캐시로하는거지우고 조건문에 공지가 아닌것이라고 줬어요.
이거 사용하실때는 기존에 latest("ddd", "ddd", "ddd");
이렇게 쓰시는것처럼 latest_no_notice("DDD", "ddd", "ddd");
이렇게 쓰시면대요~
function latest_no_notice($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')
{
global $g5;
//static $css = array();
if (!$skin_dir) $skin_dir = 'basic';
if(G5_IS_MOBILE) {
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
} else {
$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 wr_is_comment = 0 and wr_is_notice = 0 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;
}
답변을 작성하시기 전에 로그인 해주세요.