롤오버메뉴 고정 간단한 변수 문의드립니다..

롤오버메뉴 고정 간단한 변수 문의드립니다..

QA

롤오버메뉴 고정 간단한 변수 문의드립니다..

본문



롤오버 메뉴를 고정하려고 

<?

	  if(@strpos(",".$_SERVER['PHP_SELF'], "aboutus") == true){ 
		$img_src1 = "$g4[path]/images/in_menu_01_over.gif";
		$img_src1_on = "ok";
	  } else {
		$img_src1 = "$g4[path]/images/in_menu_01.gif"; 
	  } 

?>
이런식으로 나열해서 사용을 하였습니다. 원래는 현재 php만 긁어와서 읽으면 메뉴가 고정됬기 때문에
근데 그누보드쪽 게시판을 불러올려니깐 풀리네요..

그래서..

<?

	  if(@strpos(",".$_SERVER['REQUEST_URI'], "service") == true){ 
		$img_src2 = "$g4[path]/images/in_menu_02_over.gif";
		$img_src2_on = "ok";
	  } else {
		$img_src2 = "$g4[path]/images/in_menu_02.gif"; 
	  } 

?>
$_SERVER['REQUEST_URI']를 이용했죠.. 그룹명이 서브폴더명과 같았거던요.. 그걸이용해서
불러오는데.. 그누보드URL은 기본으로 그룹명을 gr_id는 생략하기때문에.. 게시판에서는 괜찮은데.. 글로 들어가면 풀려버리네요.. 그룹명을 출력하지 않아서요..




현재 사용중인.. 코드입니다.



    <?
	  if(@strpos(",".$_SERVER['PHP_SELF'], "aboutus") == true){ 
		$img_src1 = "$g4[path]/images/in_menu_01_over.gif";
		$img_src1_on = "ok";
	  } else {
		$img_src1 = "$g4[path]/images/in_menu_01.gif"; 
	  } 
	 
	  if(@strpos(",".$_SERVER['REQUEST_URI'], "service") == true){ 
		$img_src2 = "$g4[path]/images/in_menu_02_over.gif";
		$img_src2_on = "ok";
	  } else {
		$img_src2 = "$g4[path]/images/in_menu_02.gif"; 
	  } 
	  
	  if(@strpos(",".$_SERVER['REQUEST_URI'], "portfolio") == true){ 
		$img_src3 = "$g4[path]/images/in_menu_03_over.gif";
		$img_src3_on = "ok";
	  } else {
		$img_src3 = "$g4[path]/images/in_menu_03.gif"; 
	  } 
	  
	  if(@strpos(",".$_SERVER['REQUEST_URI'], "news") == true){ 
		$img_src4 = "$g4[path]/images/in_menu_04_over.gif";
		$img_src4_on = "ok";
	  } else {
		$img_src4 = "$g4[path]/images/in_menu_04.gif"; 
	  } 
	?>
    
    
            <div id="menu">
                <ul>
                    <li><a href="<?=$g4['path']?>/aboutus/overview.php">
                    <img src="<?=$img_src1?>" onMouseOver="this.src='<?=$g4['path']?>/images/in_menu_01_over.gif'" <? if(empty($img_src1_on)){ ?>onmouseout="this.src='<?=$g4['path']?>/images/in_menu_01.gif'"<? } ?>  style="cursor:hand" alt="ABOUT US"></a></li>
                    <li><a href="<?=$g4['path']?>/service/support.php">
                    <img src="<?=$img_src2?>" onMouseOver="this.src='<?=$g4['path']?>/images/in_menu_02_over.gif'" <? if(empty($img_src2_on)){ ?>onmouseout="this.src='<?=$g4['path']?>/images/in_menu_02.gif'"<? } ?>  style="cursor:hand" alt="SERVICE"></a></li>
                    <li><a href="<?=$g4['path']?>/bbs/board.php?gr_id=portfolio&bo_table=identity">
                    <img src="<?=$img_src3?>" onMouseOver="this.src='<?=$g4['path']?>/images/in_menu_03_over.gif'" <? if(empty($img_src3_on)){ ?>onmouseout="this.src='<?=$g4['path']?>/images/in_menu_03.gif'"<? } ?>  style="cursor:hand" alt="PORTFOLIO"></a></li>
                    <li><a href="<?=$g4['path']?>/bbs/board.php?gr_id=news&bo_table=d_news">
                    <img src="<?=$img_src4?>" onMouseOver="this.src='<?=$g4['path']?>/images/in_menu_04_over.gif'" <? if(empty($img_src4_on)){ ?>onmouseout="this.src='<?=$g4['path']?>/images/in_menu_04.gif'"<? } ?>  style="cursor:hand" alt="NEWS"></a></li>
                </ul>
            </div>





고수님들의 도움을 받고자 질문드립니다.
좋은 방법없을까요..?

다른 방법도 있긴한대.. 현재 사용하고 있는 것에서 보완해서 사용하고 싶습니다.

이 질문에 댓글 쓰기 :

답변 1

    if(@strpos(",".$_SERVER['PHP_SELF'], "aboutus") == true){  
        $img_src1_on = "ok"; 
    }  
    switch($bo_table){
        case "aboutus_01": // 테이블명
            $img_src1_on = "ok"; break;
    }
    if($img_src1_on=="ok") $img_src1 = "$g4[path]/images/in_menu_01_over.gif";
    else $img_src1 = "$g4[path]/images/in_menu_01.gif"; 
 
bo_table을 case 처리하면 될 것 같은대요
답변을 작성하시기 전에 로그인 해주세요.
전체 13
QA 내용 검색

회원로그인

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