좌측메뉴 활성화

좌측메뉴 활성화

QA

좌측메뉴 활성화

본문

좌측메뉴는 잘나오고 있는데요.

 

게시판 활성화시 해당 메뉴 색깔을 바꿀려고 합니다.

 

좌측메뉴 코드는 아래와 같고요.

 

 

 


 
<?php
        $tmp_code = substr($me_code,0,2);
        $tmp_menu_name=sql_fetch(" select * from {$g5['menu_table']} where me_use = '1' and length(me_code) = '2' and me_code = '$tmp_code' ");
        ?>
            <h2><?=$tmp_menu_name['me_name']?></h2>
        <?
        $sql2 = " select *
                    from {$g5['menu_table']}
                    where me_use = '1'
                      and length(me_code) = '4'
                      and substring(me_code, 1, 2) = '$tmp_code'
                    order by me_order,me_code, me_id ";
        $result2 = sql_query($sql2);
        for ($k=0; $row2=sql_fetch_array($result2); $k++) {
            if($k == 0)
                echo '<ul class="snb_2dul">'.PHP_EOL;
        ?>
            <li class="snb_2dli">
                <a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="snb_2da <?php if($row2['me_code']==substr($me_code,0,4)) { echo "on"; }?>"><?php echo $row2['me_name'] ?></a>
        <?php
            //3차메뉴 불러 오기.
            $sql3 = " select *
                        from {$g5['menu_table']}
                        where me_use = '1'
                          and length(me_code) = '6'
                          and substring(me_code, 1, 4) = '{$row2['me_code']}'
                        order by me_order,me_code, me_id ";
            $result3 = sql_query($sql3);
            $num3 = sql_num_rows($result3);
            if($num3>0){
                echo '<ul class="snb_3dul">'.PHP_EOL;
                while($row3=sql_fetch_array($result3)){
        ?>
                    <li class="snb_3dli">
                        <a href="<?php echo $row3['me_link']; ?>" target="_<?php echo $row3['me_target']; ?>" class="snb_3da <?php if($row3['me_code']==$me_code) { echo "on2"; }?>">-  <?php echo $row3['me_name'] ?></a>
                    </li>
        <?php
                }
                echo '</ul>'.PHP_EOL;
            }
            echo '</li>'.PHP_EOL;                   
        }
        if($k > 0)
            echo '</ul>'.PHP_EOL;
        ?>

 

코드중에서

if($row2['me_code']==substr($me_code,0,4)) { echo "on"; }

if($row3['me_code']==$me_code) { echo "on2"; }

 

 

두가지가 작동하지 않는 이유를 모르겠습니다.

 

 

 

고수님들 답변좀 부탁드립니다.

이 질문에 댓글 쓰기 :

답변 1

답변을 작성하시기 전에 로그인 해주세요.
전체 34
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT