메뉴 관련 문의 드립니다.
본문
메뉴를 다운받아서 사용했는데요
메뉴를 선택하면 1dept에 색상이 변경되게 되어 있는데
자꾸 메뉴 하나만 다른 메뉴에 색상이 변경되길 래 확인 해봤는데
아래 소스인데요
<?php if($row[me_order]==$me_co){echo ' current'.$me_order;} ?>
이부분에서 색을 변경해는 것 같은데 me_code와 mo_order가 같은경 우 인데
제껄 DB에서 확인해보니 다르게 되어있는 메뉴들이 많은데
이걸 DB에서 임의로 수정해도 될 지..
아니면 저부분을 어떻게 수정해야할지...
혹시 이 메뉴를 사용하면서
2dept 메뉴 선택시 2dept 메뉴가 계속 활 성 화되게 할 수 있는 방법이 있을지..
여쭤봐도 될까요?ㅠㅠ
답변 부탁드리며
항상 도움주셔서 감사합니다!!
<nav id="lnb">
<h2>메인메뉴</h2>
<ul id="lnb_1dul">
<?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);
$lnb_zindex = 999; // lnb_1dli z-index 값 설정용
for ($i=0; $row=sql_fetch_array($result); $i++) {
// link주소에 파라미터가 있는 경우
if(strstr($row['me_link'], ".php?"))
$qstr2 = "&me_code=".$row['me_code'];
// link주소에 파라미터가 없는 경우
else
$qstr2 = "?me_code=".$row['me_code'];
$me_str = $me_code;
$me_co = substr($me_str, 0, 1);
?>
<li class="lnb_1dli<?php if($row[me_order]==$me_co){echo ' current'.$me_order;} ?>" style="z-index:<?php echo $lnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?><?php echo $qstr2; ?>" target="_<?php echo $row['me_target']; ?>" class="lnb_1da"><?php echo $row['me_name'] ?></a>
<?php
$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++) {
// link주소에 파라미터가 있는 경우
if(strstr($row2['me_link'], ".php?"))
$qstr2 = "&me_code=".$row2['me_code'];
// link주소에 파라미터가 없는 경우
else
$qstr2 = "?me_code=".$row2['me_code'];
if($k == 0)
echo '<ul class="lnb_2dul">'.PHP_EOL;
?>
<li class="lnb_2dli"><a href="<?php echo $row2['me_link']; ?><?php echo $qstr2; ?>" target="_<?php echo $row2['me_target']; ?>" class="lnb_2da"><?php echo $row2['me_name'] ?></a></li>
<?php
}
if($k > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
}
if ($i == 0) { ?>
<li id="lnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <br><a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
</ul>
<div class="all"><div></div></div>
</nav>
<script type="text/javascript">
$(document).ready(function(){
$('.lnb_2dul li:first-child').addClass('first');
$('.lnb_2dul li:last-child').addClass('last');
var heights = $(".lnb_2dul").map(function(){
return $(this).height();
}).get(),
maxHeight = Math.max.apply(null, heights);
$('#lnb_1dul').hover(function(){
$('.all').stop().animate({height:maxHeight},100);
$('.lnb_2dul').show();
$('.lnb_2dul').stop().animate({height:maxHeight},100);
},function(){
$('.all').stop().animate({height:0},100);
$('.lnb_2dul').hide();
$('.lnb_2dul').stop().animate({height:0},100);
});
$('.lnb_1da').focus(function(){
$('.all').animate({height:maxHeight},100);
$('.lnb_2dul').slideDown(100);
$('.lnb_2dul').animate({height:maxHeight},100);
});
$('.lnb_1dli a:last').blur(function(){
$('.all').animate({height:0},100);
$('.lnb_2dul').slideUp(100);
$('.lnb_2dul').animate({height:0},100);
});
});
</script>
!-->
답변 1
me_code 는 순서를 지정하는 데이터 이기 때문에 수정하시면 안되구요!
조금 응용하자면, 메뉴 테이블에 여분필드를 추가하시어 위에 첨부하신 소스처럼
링크주소 끝에 파라미터로 add_code 를 넘기시고 해당 메뉴코드 파라미터가 넘어온 부분만
css 클래스로 active 처리 하시면 되지 않을까 싶습니다..!!
답변을 작성하시기 전에 로그인 해주세요.