게시판에 새로운글이 올라오면 메뉴옆에 new이미지를 넣고 싶은데요 정보
게시판에 새로운글이 올라오면 메뉴옆에 new이미지를 넣고 싶은데요본문
<?php
//24시간 이내의 글 수 알아내기
function new_count($table_id){
// 오늘을 불러옵니다.
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
// 여기는 오늘과 글쓴 날짜를 비교합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime'";
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."]";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
----------------------------------------
이렇게 함수를 집어넣고 원하시는 장소에...
예를 들어 왼쪽에 '자유게시판'이라는 메뉴가 있고 그 옆에 글 갯수를 출력하기 위해
<?=new_count(테이블명);?>
//24시간 이내의 글 수 알아내기
function new_count($table_id){
// 오늘을 불러옵니다.
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
// 여기는 오늘과 글쓴 날짜를 비교합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime'";
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."]";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
----------------------------------------
이렇게 함수를 집어넣고 원하시는 장소에...
예를 들어 왼쪽에 '자유게시판'이라는 메뉴가 있고 그 옆에 글 갯수를 출력하기 위해
<?=new_count(테이블명);?>
이소스를 팁게시판에서 봣는데
되긴되는데
여기서 new이미지가 옆에 뜨게 하려면 어디를 어떻게 수정해야하는지요?
위에꺼데로 하면 몇개에 새글이 올라왓는지 숫자로 나오더라구요 ㅎㅎ;
댓글 전체
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."] 여기에 새글용 이미지 태그를 넣어주면 될것 같은데요.";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."] 여기에 새글용 이미지 태그를 넣어주면 될것 같은데요.";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
<?php
//24시간 이내의 글 수 알아내기
function new_count($table_id){
// 오늘을 불러옵니다.
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
// 여기는 오늘과 글쓴 날짜를 비교합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime'";
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."]<img src=images/new.gif width=15 height=6 border=0>";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
이런식으로 넣었는데 안뜹니당 -0-;
//24시간 이내의 글 수 알아내기
function new_count($table_id){
// 오늘을 불러옵니다.
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
// 여기는 오늘과 글쓴 날짜를 비교합니다.
$tmp_write_table .= "g4_write_$table_id";
$sql2 = " select wr_datetime from $tmp_write_table where wr_datetime >= '$intime'";
// 새로운 글이 몇개 있는지 확인합니다.
$result2 = sql_query($sql2);
$total_count = mysql_num_rows($result2);
if ($total_count > 0) {
$str_cnt .= " [".$total_count."]<img src=images/new.gif width=15 height=6 border=0>";
return $str_cnt;
}
else {
$str_cnt .= "";
return $str_cnt;
}
}
?>
이런식으로 넣었는데 안뜹니당 -0-;
이미지가 있는 경로가 정확한지 확인해 보실래요.
경로는 정확하구요
이미지가 안나오고 숫자가 나와염 ㅡㅡ
이미지가 안나오고 숫자가 나와염 ㅡㅡ
$str_cnt .= "<img src=http://경로/images/new.gif width=15 height=6 border=0>";
라고 넣은후 테스트 해보실래요.
라고 넣은후 테스트 해보실래요.
흐흐 됩니다^^ 감사^^
이거 팁으로 좀 올려주세요 헐랭이님 팁으로 ㅋㅋㅋ
이거 팁으로 좀 올려주세요 헐랭이님 팁으로 ㅋㅋㅋ
찾던겁니다
증말 감사요~ ^^
증말 감사요~ ^^
뉴아이콘