PHP 왼쪽 메뉴 include 사용시 마우스 over 효과내기 위한 소스
페이지 정보
본문
### 함수설명 ###
$_SERVER['PHP_SELF'] : 홈페이지 주소중 ***.com 등을 제외한 경로
/greet.php : 실제 열린 페이지
예) https://www.happyjung.com/greet.php 인경우
각 메뉴를 아래와 같이 php코드처리하면 각 페이지가 열린후 왼쪽메뉴가 해당위치를 가르키고 있어서 직독성을 향상시킬수 있습니다.
### 일반적인 방식 ###
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01_ov.gif',1)"><img src="left01.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02_ov.gif',1)"><img src="left02.gif" name="left02" border="0" id="left02"></a></td>
</tr>
</table>
### 해피정닷컴 제안 ###
<table border="0" cellpadding="0" cellspacing="0">
<?php if ($_SERVER['PHP_SELF'] == '/greet.php') { // ?>
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01.gif',1)"><img src="left01_ov.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01_ov.gif',1)"><img src="left01.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<?php } ?>
<?php if ($_SERVER['PHP_SELF'] == '/history.php') { // ?>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02.gif',1)"><img src="left02_ov.gif" name="left02" border="0" id="left02"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02_ov.gif',1)"><img src="left02.gif" name="left02" border="0" id="left02"></a></td>
</tr>
<?php } ?>
</table>
### 실무응용 ###
<?php if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // ?>
<?php } else { ?>
<?php } ?>
<?php if ($bo_table == 'maintenance') { // 게시판 등에서의 함수 ?>
<?php } elseif ($bo_table == 'aaa' || $_SERVER['PHP_SELF'] == '/bbb.php') { // bb_table=aaa 이거나 홈페이주소 = /bbs.php 둘중에 하나만 맞을때 ?>
<?php } else { ?>
<?php } ?>
그누보드에서의 응용 ( 2007/03/21 추가 )
<?php if ($bo_table == 'maintenance') { // ?>
<tr>
<td><a href="/bbs/board.html?bo_table=maintenance"><img src="/v4/images/left_portfolio_02_ov.gif" alt="" border="0"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="/bbs/board.html?bo_table=maintenance"><img src="/v4/images/left_portfolio_02.gif" alt="" border="0"></a></td>
</tr>
<?php } ?>
그누보드5 활용2 ( 2018-04-10 추가 )
<?php
$base_URL = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_URL .= ($_SERVER['SERVER_PORT'] != '80') ? $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] : $_SERVER['HTTP_HOST'];
$base_URL .= $_SERVER['REQUEST_URI'];
?>
<?php if ($base_URL==G5_BBS_URL."/register.php" || $base_URL==G5_BBS_URL."/register_form.php" || $base_URL==G5_BBS_URL."/register_result.php") { ?>
<?php } ?>
CSS 활용법 ( 2014-09-09 )
<style>
.leftmenu_ov { background-image:url(/v1/images/leftmenu_bg.gif); background-repeat:repeat-x; height:30px; font-weight:bold; padding: 2px 0 0 15px; color:#ffffff; width:180px; text-align:left; }
a:link.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:active.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:visited.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:hover.leftmenu_ov2 {text-decoration:underline; color:#FFFF00; background-repeat:repeat-x; }
.leftmenu_no { background-image:url(/v1/images/leftmenu_bg2.gif); background-repeat:repeat-x; height:30px; padding: 3px 0 0 15px; width:180px; text-align:left; }
a:link.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:active.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:visited.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:hover.leftmenu_no2 {text-decoration:underline; color:#1e71cf; background-repeat:repeat-x; }
</style>
<?php if ($bo_table == 'maintenance') { // ?>
<div class="leftmenu_ov"><a href="board.html?board=maintenance" class="leftmenu_ov2"><img src="left_portfolio_02_ov.gif" alt="" border="0"></a></div>
<?php } else { ?>
<div class="leftmenu_no"><a href="board.html?board=maintenance" class="leftmenu_no2"><img src="left_portfolio_02.gif" alt="" border="0"></a></div>
<?php } ?>
$_SERVER['PHP_SELF'] : 홈페이지 주소중 ***.com 등을 제외한 경로
/greet.php : 실제 열린 페이지
예) https://www.happyjung.com/greet.php 인경우
각 메뉴를 아래와 같이 php코드처리하면 각 페이지가 열린후 왼쪽메뉴가 해당위치를 가르키고 있어서 직독성을 향상시킬수 있습니다.
### 일반적인 방식 ###
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01_ov.gif',1)"><img src="left01.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02_ov.gif',1)"><img src="left02.gif" name="left02" border="0" id="left02"></a></td>
</tr>
</table>
### 해피정닷컴 제안 ###
<table border="0" cellpadding="0" cellspacing="0">
<?php if ($_SERVER['PHP_SELF'] == '/greet.php') { // ?>
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01.gif',1)"><img src="left01_ov.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="greet.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left01','','left01_ov.gif',1)"><img src="left01.gif" name="left01" border="0" id="left01"></a></td>
</tr>
<?php } ?>
<?php if ($_SERVER['PHP_SELF'] == '/history.php') { // ?>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02.gif',1)"><img src="left02_ov.gif" name="left02" border="0" id="left02"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="history.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('left02','','left02_ov.gif',1)"><img src="left02.gif" name="left02" border="0" id="left02"></a></td>
</tr>
<?php } ?>
</table>
### 실무응용 ###
<?php if ($_SERVER['PHP_SELF'] == '/v4/about/greet.php') { // ?>
<?php } else { ?>
<?php } ?>
<?php if ($bo_table == 'maintenance') { // 게시판 등에서의 함수 ?>
<?php } elseif ($bo_table == 'aaa' || $_SERVER['PHP_SELF'] == '/bbb.php') { // bb_table=aaa 이거나 홈페이주소 = /bbs.php 둘중에 하나만 맞을때 ?>
<?php } else { ?>
<?php } ?>
그누보드에서의 응용 ( 2007/03/21 추가 )
<?php if ($bo_table == 'maintenance') { // ?>
<tr>
<td><a href="/bbs/board.html?bo_table=maintenance"><img src="/v4/images/left_portfolio_02_ov.gif" alt="" border="0"></a></td>
</tr>
<?php } else { ?>
<tr>
<td><a href="/bbs/board.html?bo_table=maintenance"><img src="/v4/images/left_portfolio_02.gif" alt="" border="0"></a></td>
</tr>
<?php } ?>
그누보드5 활용2 ( 2018-04-10 추가 )
<?php
$base_URL = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_URL .= ($_SERVER['SERVER_PORT'] != '80') ? $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] : $_SERVER['HTTP_HOST'];
$base_URL .= $_SERVER['REQUEST_URI'];
?>
<?php if ($base_URL==G5_BBS_URL."/register.php" || $base_URL==G5_BBS_URL."/register_form.php" || $base_URL==G5_BBS_URL."/register_result.php") { ?>
<?php } ?>
CSS 활용법 ( 2014-09-09 )
<style>
.leftmenu_ov { background-image:url(/v1/images/leftmenu_bg.gif); background-repeat:repeat-x; height:30px; font-weight:bold; padding: 2px 0 0 15px; color:#ffffff; width:180px; text-align:left; }
a:link.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:active.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:visited.leftmenu_ov2 {text-decoration: none; color: #ffffff; background-repeat:repeat-x; }
a:hover.leftmenu_ov2 {text-decoration:underline; color:#FFFF00; background-repeat:repeat-x; }
.leftmenu_no { background-image:url(/v1/images/leftmenu_bg2.gif); background-repeat:repeat-x; height:30px; padding: 3px 0 0 15px; width:180px; text-align:left; }
a:link.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:active.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:visited.leftmenu_no2 {text-decoration: none; color: #000000; background-repeat:repeat-x; }
a:hover.leftmenu_no2 {text-decoration:underline; color:#1e71cf; background-repeat:repeat-x; }
</style>
<?php if ($bo_table == 'maintenance') { // ?>
<div class="leftmenu_ov"><a href="board.html?board=maintenance" class="leftmenu_ov2"><img src="left_portfolio_02_ov.gif" alt="" border="0"></a></div>
<?php } else { ?>
<div class="leftmenu_no"><a href="board.html?board=maintenance" class="leftmenu_no2"><img src="left_portfolio_02.gif" alt="" border="0"></a></div>
<?php } ?>
댓글목록
등록된 댓글이 없습니다.