p

[메뉴함수] 그룹메뉴 호출함수 업데이트

샘플
http://tjdgud.co.kr/gn/bbs/board.php?bo_table=bbb2

원본함수
http://www.sir.co.kr/bbs/tb.php/g4_tiptech/6245

저기있는 group_menu2의 함수의 업데이트(추가해주시면 됩니다.)

업데이트 내역-------------------
선택한 게시판의 볼드타입 주기
새로운 게시물의 24시이내의 개수 출력(헐랭이님의 코드참조했습니다.)
테스트시 새로운글을 적어봐야지.. 어떻게 나오는지 알수 있다.
--------------------------------------
응용 : new아이콘 주기/선택한것의 색상값 주기
-------------------------------------
참고 : 보안상 문제가 생겨도 모름
-------------------------------------

function group_menu2($skin_dir="",$m_gr_id="") {
global $g4;
global $gr_id;
global $bo_table;
if($m_gr_id=="") $m_gr_id = $gr_id;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/group_menu/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/group_menu/basic";

$list = array();
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$sql = "select bo_table, bo_subject from $g4[board_table] where gr_id = '$m_gr_id' and bo_10 > 0 order by bo_10";

$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$sql2 = " select wr_datetime from ".$g4[write_prefix].$row[bo_table]. " where wr_datetime >= '$intime'";
$m_count =mysql_num_rows(sql_query($sql2));
if ($m_count > 0) $m_count = ' (+'.$m_count.')'; else $m_count ="";
$list[$i][bo_subject] = $row[bo_subject].$m_count;
$list[$i][bo_table] = $row[bo_table];

if($list[$i][bo_table] == $bo_table) $list[$i][bo_subject] = '<b>'.$list[$i][bo_subject];
}

ob_start();
include "$latest_skin_path/menu.skin.php";
$content = ob_get_contents();
ob_end_clean();

return $content;
}
|

댓글 2개

위의루틴 그대로 응용
그룹별 새로운 게시물.. 개수 가져오기 함수
function group_count($m_gr_id="") {
global $g4;
$m_list = array();
$m_count_sum = 0;
$intime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * 24));
$sql = "select bo_table, bo_10 from $g4[board_table] where gr_id = '$m_gr_id' and bo_10 > 0 order by bo_10";

$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$sql2 = " select wr_datetime from ".$g4[write_prefix].$row[bo_table]. " where wr_datetime >= '$intime'";
$m_count =mysql_num_rows(sql_query($sql2));
$m_count_sum = $m_count_sum + $m_count;
}
return $m_count_sum;
}

샘플
http://www.sc8000.net/gn/bbs/group.php?gr_id=program 의 상단에 보면(+1)형태로 나온것
생각이 짧아서.. db를 노가다 시키는듯 미안함.. 흐흐
참 다양한 팁올려주셔서 감사드립니다
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 팁자료실

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

+
제목 글쓴이 날짜 조회
19년 전 조회 5,367
19년 전 조회 5,711
19년 전 조회 3,889
19년 전 조회 2,647
19년 전 조회 3,280
19년 전 조회 4,180
19년 전 조회 4,344
19년 전 조회 3,830
19년 전 조회 3,567
19년 전 조회 3,332
19년 전 조회 3,347
19년 전 조회 3,297
19년 전 조회 4,248
19년 전 조회 3,660
19년 전 조회 3,105
19년 전 조회 2,694
19년 전 조회 2,612
19년 전 조회 3,782
19년 전 조회 4,178
19년 전 조회 3,099
🐛 버그신고