새 글이 있으면 new icon 표시하기 정보
새 글이 있으면 new icon 표시하기본문
저는 아래와 같은 함수를 /extend/function.extend.php 파일에 넣어두고 있습니다.
사용하는 방법은 원하는 위치에 <?new_icon("게시판bo_table값")?> 이런식으로 써주시면 됩니다.
초보자 분들은 http://gnucomun.net/sp/study.14 이 링크를 참고하시면 도움이 될 듯 합니다.
function new_icon($bo_table) {
global $g4;
$temp = sql_fetch("select bo_new from `$g4[board_table]` where bo_table = '$bo_table'");
$timefrom = date("Y-m-d H:i:s", time() - $temp[bo_new] * 60 * 60);
if(sql_fetch("select wr_datetime from `$g4[write_prefix]$bo_table` where !wr_is_comment AND wr_datetime > '$timefrom'")) echo " <img src=\"$g4[path]/skin/board/basic/img/icon_new.gif\" />";
}
global $g4;
$temp = sql_fetch("select bo_new from `$g4[board_table]` where bo_table = '$bo_table'");
$timefrom = date("Y-m-d H:i:s", time() - $temp[bo_new] * 60 * 60);
if(sql_fetch("select wr_datetime from `$g4[write_prefix]$bo_table` where !wr_is_comment AND wr_datetime > '$timefrom'")) echo " <img src=\"$g4[path]/skin/board/basic/img/icon_new.gif\" />";
}
사용하는 방법은 원하는 위치에 <?new_icon("게시판bo_table값")?> 이런식으로 써주시면 됩니다.
초보자 분들은 http://gnucomun.net/sp/study.14 이 링크를 참고하시면 도움이 될 듯 합니다.
추천
7
7
댓글 8개
mahler83geniusboard 는 게시판 명을 써주는건가요?
네 수정했습니다
고마워요~~
감사합니다~!! 메뉴가 많으면 부하가 일어나네요 ㅎㅎㅎ 그럴땐 말러캐쉬를 써주셔야 할듯~
말러 님, 그럼, 특정 게시판에 한해서는 댓글이 달릴 때마다 new 이미지가 뜨게 하려면 어떻게 해야 할까요?
맨 아래 조건문을 2가지 종류로 나눠줘야겠네요. 특정 게시판일 경우에는 wr_is_comment를 검사하지 않고, 나머지의 경우는 코멘트인 경우 제외
힌트 고맙습니다. 좋은 하루 되세요!