[PHP] 왼쪽 메뉴 include 사용시 over 효과내기 위한 소스 (2007/05/23 수정)
로빈아빠
본문
### 함수설명 ###
$_SERVER['PHP_SELF'] : 홈페이지 주소중 ***.com 등을 제외한 경로
/v4/about/greet.php : 실제 열린 페이지
예) http://www.happyjung.com/v4/about/greet.php 인경우
각 메뉴를 아래와 같이 php코드처리하면 각 페이지가 열린후 왼쪽메뉴가 해당위치를 가르키고 있어서 직독성을 향상시킬수 있습니다.
### 일반적인 방식 ###
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01_ov.gif',1)"><img src="/v4/images/left_about_01.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02_ov.gif',1)"><img src="/v4/images/left_about_02.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
</table>
### 해피정닷컴 제안 ###
<table border="0" cellpadding="0" cellspacing="0">
<? if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // 인사말 ?>
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01.gif',1)"><img src="/v4/images/left_about_01_ov.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01_ov.gif',1)"><img src="/v4/images/left_about_01.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<? } ?>
<? if ($_SERVER['PHP_SELF'] == '/v4/about/history.php') { // 연혁 ?>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02.gif',1)"><img src="/v4/images/left_about_02_ov.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02_ov.gif',1)"><img src="/v4/images/left_about_02.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
<? } ?>
</table>
### 실무응용 ###
<? if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // 인사말 ?>
<? } else { ?>
<? } ?>
<? if ($bo_table == 'maintenance') { // 게시판 등에서의 함수 ?>
<? } elseif ($bo_table == 'aaa' || $_SERVER['PHP_SELF'] == '/bbb.php') { // bb_table=aaa 이거나 홈페이주소 = /bbs.php 둘중에 하나만 맞을때 ?>
<? } else { ?>
<? } ?>
그누보드에서의 응용 ( 2007/03/21 추가 )
<? if ($bo_table == 'maintenance') { // 작업현황 ?>
<tr>
<td><a href="/gnuboard/bbs/board.php?bo_table=maintenance"><img src="/v4/images/left_portfolio_02_ov.gif" alt="작업현황" border="0"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/gnuboard/bbs/board.php?bo_table=maintenance"><img src="/v4/images/left_portfolio_02.gif" alt="작업현황" border="0"></a></td>
</tr>
<? } ?>
$_SERVER['PHP_SELF'] : 홈페이지 주소중 ***.com 등을 제외한 경로
/v4/about/greet.php : 실제 열린 페이지
예) http://www.happyjung.com/v4/about/greet.php 인경우
각 메뉴를 아래와 같이 php코드처리하면 각 페이지가 열린후 왼쪽메뉴가 해당위치를 가르키고 있어서 직독성을 향상시킬수 있습니다.
### 일반적인 방식 ###
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01_ov.gif',1)"><img src="/v4/images/left_about_01.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02_ov.gif',1)"><img src="/v4/images/left_about_02.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
</table>
### 해피정닷컴 제안 ###
<table border="0" cellpadding="0" cellspacing="0">
<? if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // 인사말 ?>
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01.gif',1)"><img src="/v4/images/left_about_01_ov.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/v4/about/greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','/v4/images/left_about_01_ov.gif',1)"><img src="/v4/images/left_about_01.gif" name="left01" width="180" height="24" border="0" id="left01"></a></td>
</tr>
<? } ?>
<? if ($_SERVER['PHP_SELF'] == '/v4/about/history.php') { // 연혁 ?>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02.gif',1)"><img src="/v4/images/left_about_02_ov.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/v4/about/history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','/v4/images/left_about_02_ov.gif',1)"><img src="/v4/images/left_about_02.gif" name="left02" width="180" height="24" border="0" id="left02"></a></td>
</tr>
<? } ?>
</table>
### 실무응용 ###
<? if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // 인사말 ?>
<? } else { ?>
<? } ?>
<? if ($bo_table == 'maintenance') { // 게시판 등에서의 함수 ?>
<? } elseif ($bo_table == 'aaa' || $_SERVER['PHP_SELF'] == '/bbb.php') { // bb_table=aaa 이거나 홈페이주소 = /bbs.php 둘중에 하나만 맞을때 ?>
<? } else { ?>
<? } ?>
그누보드에서의 응용 ( 2007/03/21 추가 )
<? if ($bo_table == 'maintenance') { // 작업현황 ?>
<tr>
<td><a href="/gnuboard/bbs/board.php?bo_table=maintenance"><img src="/v4/images/left_portfolio_02_ov.gif" alt="작업현황" border="0"></a></td>
</tr>
<? } else { ?>
<tr>
<td><a href="/gnuboard/bbs/board.php?bo_table=maintenance"><img src="/v4/images/left_portfolio_02.gif" alt="작업현황" border="0"></a></td>
</tr>
<? } ?>
관련링크
댓글목록
등록된 댓글이 없습니다.