왼쪽 메뉴 include 사용시 마우스 over 효과내기 위한 소스 > 기술자료 | 해피정닷컴

왼쪽 메뉴 include 사용시 마우스 over 효과내기 위한 소스 > 기술자료

본문 바로가기

사이트 내 전체검색

왼쪽 메뉴 include 사용시 마우스 over 효과내기 위한 소스 > 기술자료

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 } ?>

댓글목록

등록된 댓글이 없습니다.


Total 195건 6 페이지
  • RSS
기술자료 목록
95
PHP   21436  2012-03-16 23:55 ~ 2014-12-28 00:00  
94
PHP   22471  2012-03-04 17:29  
93
PHP   21209  2012-03-04 17:09 ~ 2023-01-08 11:38  
92
PHP   27070  2012-03-01 21:47 ~ 2012-04-08 00:00  
91
PHP   15305  2012-02-11 08:05  
90
PHP   23242  2011-12-16 17:50 ~ 2017-12-01 23:10  
89
PHP   35045  2011-12-16 14:24  
88
PHP   14328  2011-12-16 11:56  
87
PHP   34733  2011-12-10 17:48 ~ 2011-12-17 00:00  
86
PHP   21772  2011-12-10 17:48  
85
PHP   18342  2011-11-28 08:46 ~ 2017-01-13 00:00  
84
PHP   15660  2011-08-15 20:08  
83
PHP   15096  2011-07-26 07:10  
82
PHP   24300  2011-06-12 20:30 ~ 2024-02-28 09:43  
81
PHP   29016  2011-04-20 19:59  
80
PHP   22140  2011-03-27 21:51  
79
PHP   19195  2011-02-24 16:10 ~ 2021-11-23 09:25  
78
PHP   27420  2010-09-24 20:57  
77
PHP   17021  2010-08-25 11:34  
76
PHP   15756  2010-08-21 09:37 ~ 2014-10-06 00:00  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: 서울센터 (08393) 서울시 구로구 디지털로32가길 16 파트너스타워2차 1206-280호
        대전센터 (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 지원1동 205호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 2014-서울구로-0074 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.