1차메뉴 현재위치(location) 때깔넣기 2 > 그누보드5 팁자료실

그누보드5 팁자료실

1차메뉴 현재위치(location) 때깔넣기 2 정보

1차메뉴 현재위치(location) 때깔넣기 2

본문

3024275063_1528267919.6636.png

1차메뉴(하위포함)에 색갈 넣기 두번째 입니다.

 

1. head.php에서 맨위쪽의 <?php ~ ?>바로 아래에 다음내용 추가

<?php // minyho active menu

if($bo_table){
$menu_url = G5_URL."/bbs/board.php?bo_table=".$bo_table;

 }else{$menu_url = G5_URL.$_SERVER[REQUEST_URI];

 }
$menu = sql_fetch(" select * from {$g5['menu_table']} where me_use = '1' and me_link = '$menu_url' ");

 $me_code = substr($menu[me_code],0,2);

 $sql = " select * from {$g5['menu_table']} where me_use = '1' and me_code = '$me_code' ";

 $result = sql_query($sql, false);

 for ($i=0; $row=sql_fetch_array($result); $i++) {$txt=$row['me_name'];

} ?>

 

2. 아래의 내용을 교체하세요.

(대략 107~139 line)

<li class="gnb_1dli gnb_mnal"><button type="button" class="gnb_menu_btn"><i class="fa fa-bars" aria-hidden="true"></i><span class="sound_only">전체메뉴열기</span></button></li>
                <?php
                $sql = " select *
                            from {$g5['menu_table']}
                            where me_use = '1'
                              and length(me_code) = '2'
                            order by me_order, me_id ";
                $result = sql_query($sql, false);
                $gnb_zindex = 999; // gnb_1dli z-index 값 설정용
                $menu_datas = array();

                for ($i=0; $row=sql_fetch_array($result); $i++) {
                    $menu_datas[$i] = $row;

                    $sql2 = " select *
                                from {$g5['menu_table']}
                                where me_use = '1'
                                  and length(me_code) = '4'
                                  and substring(me_code, 1, 2) = '{$row['me_code']}'
                                order by me_order, me_id ";
                    $result2 = sql_query($sql2);
                    for ($k=0; $row2=sql_fetch_array($result2); $k++) {
                        $menu_datas[$i]['sub'][$k] = $row2;
                    }

                }

                $i = 0;
                foreach( $menu_datas as $row ){
                    if( empty($row) ) continue;
                ?>
 <li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
                    <a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a>

으로

<li class="gnb_1dli gnb_mnal"><button type="button" class="gnb_menu_btn"><i class="fa fa-bars" aria-hidden="true"></i><span class="sound_only">전체메뉴열기</span></button></li>
            <?php
            $sql = " select *
    from {$g5['menu_table']}
     where me_use = '1'
     and length(me_code) = '2'
     order by me_order, me_id ";
   $result = sql_query($sql, false);
   $gnb_zindex = 999; // gnb_1dli z-index 값 설정용
   
   for ($i=0; $row=sql_fetch_array($result); $i++) {
   $sql2 = " select *
     from {$g5['menu_table']}
     where me_use = '1'
     and length(me_code) = '4'
     and substring(me_code, 1, 2) = '{$row['me_code']}'
     order by me_order, me_id ";
   $result2 = sql_query($sql2);
   $row['cnt'] = @sql_num_rows($result2);
   ?>
    <?php if ($txt == $row['me_name']) { ?>
 <li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
                <a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da" style="color:#fa6000;"><?php echo $row['me_name'] ?></a>
    <?php } else { ?>
 <li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
                    <a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a>

끝.

추천3

댓글 전체

전체 1,253 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

진행중 포인트경매

  1. 그누위즈의 PHP&MySQL 웹 프로그래밍 입문+활용

    참여4 회 시작18.11.16 13:47 종료18.11.21 13:47
  2. 강정 감귤 5kg 한박스

    참여37 회 시작18.11.13 20:00 종료18.11.18 20:00
  3. 다래사랑) 레드키위 or 골드키위 3Kg 한박스

    참여32 회 시작18.11.13 11:45 종료18.11.18 11:45

(주)에스아이알소프트 (06253) 서울특별시 강남구 도곡로1길 14, 6층 624호 (역삼동, 삼일프라자) 대표메일:admin@sir.kr
사업자등록번호:217-81-36347 대표:홍석명 통신판매업신고번호:2014-서울강남-02098호 개인정보보호책임자:이총

© SIRSOFT