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>

끝.

추천2

댓글 전체

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

회원로그인

진행중 포인트경매

  1. 휴대용 선풍기 아이리버 BF-C26

    참여151 회 시작18.06.18 10:32 종료18.06.23 10:32
  2. LED 펫램프 - 송갑석 남대협 의장 국회의원 당선 기념

    참여59 회 시작18.06.15 12:00 종료18.06.20 12:00

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

© SIRSOFT