[메뉴함수] 그룹메뉴 호출함수 업데이트 > 그누4 팁자료실

그누4 팁자료실

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

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

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

본문

샘플
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;
}
추천
0
  • 복사

댓글 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를 노가다 시키는듯 미안함.. 흐흐
© SIRSOFT
현재 페이지 제일 처음으로