1차메뉴 현재위치(location) 때깔넣기 정보
1차메뉴 현재위치(location) 때깔넣기본문
<head.php 수정>
추가
<?php if ($board) { $txt = $board['bo_subject']; } ?>
<!-- 상단 시작 { -->
변경
<li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a>
를
으로
<li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>"><?php if ($txt == $row['me_name']) { ?>
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da" style="color:#f00"><?php echo $row['me_name'] ?></a>
<?php } else { ?>
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a>
<?php } ?>
끝.
style="color:#f00"은 취향에 맞게 수정하세요.
2
댓글 26개
<?php if ($board) { $txt = $board['bo_subject']; } ?>
을
으로
<?php if ($board['bo_subject'] == "갤러리" or $board['bo_subject'] == "갤러리01" or $board['bo_subject'] == "갤러리02" or $board['bo_subject'] == "갤러리03" ) {$txt="갤러리";} ?>
or
<?php
$sql = " select * from {$g5['menu_table']} where me_use = '1' and me_code = '$me_code' ";
$result = sql_query($sql, false);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$txt=$row['me_name'] ?>
<?php } ?>
넣고 인크루드 추가..
맨위의 중간에
if($bo_table){
$menu_url = G5_URL."/bbs/board.php?bo_table=".$bo_table;
}else{
$menu_url = G5_URL.$_SERVER[REQUEST_URI];
}
$menu = sql_fetch(" select * from {$g5['menu_table']} where me_use = '1' and me_link = '$menu_url' ");
$me_code = substr($menu[me_code],0,2);
추가후
맨위의 ?> 아래에
<?php
$sql = " select * from {$g5['menu_table']} where me_use = '1' and me_code = '$me_code' ";
$result = sql_query($sql, false);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$txt=$row['me_name'] ?>
<?php } ?>
넣고
<li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a>
를
아래로
<?php if ($txt == $row['me_name']) { ?><li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da" style="color:#fa6000"><?php echo $row['me_name'] ?></a>
<?php } else { ?>
<li class="gnb_1dli" style="z-index:<?php echo $gnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?php echo $row['me_name'] ?></a><?php } ?>
하면 끝입니다.
<?php
$menu_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$menu = sql_fetch(" select * from {$g5['menu_table']} where me_use = '1' and me_link = '$menu_url' ");
$me_code = substr($menu['me_code'],0,2);
$sql = " select * from {$g5['menu_table']} where me_use = '1' and me_code = '$me_code' ";
$result = sql_query($sql, false);
for ($i=0; $row=sql_fetch_array($result); $i++){$txt = $row['me_name'];$txtx = $row['me_link'];}
$sql2 = " select * from {$g5['menu_table']} where me_use = '1' and substring(me_code, 1, 2) = '$me_code' order by me_order, me_id ";$result2 = sql_query($sql2);
for ($m=0; $row2=sql_fetch_array($result2); $m++){if($row2['me_link'] == $menu_url) $txt2 = $row2['me_name'];$txty = $row2['me_link'];}
if(strpos(G5_URL.$_SERVER['REQUEST_URI'], '=') != '') $s20 = '=';else $s20 = '/';
?>
<nav id="gnb" class="dblclick">
<h2>메인메뉴</h2>
<div class="gnb_wrap">
<ul id="gnb_1dul">
<li class="gnb_1dli" style="width:150px;top:-2px"><!--a href="<?php echo G5_URL ?>/indexb.php"><p id="logo" style="font-size:2.2em;font-weight:bold;color:#414141;text-align:left;text-shadow: #dcdcdc 1px 1px;"><font color="#ff0000"><?php echo utf8_strcut($config['cf_title'], 1, '')?></font><?php echo mb_substr($config['cf_title'],1,4,'utf-8')?><font color="#00a0ff"><?php echo mb_substr($config['cf_title'],5,1,'utf-8')?></font><?php echo mb_substr($config['cf_title'],6,10,'utf-8')?></p></a--><a href="<?php echo G5_URL ?>"><h1 class="glowkim" style="padding-top:0px" title="Welcome to DANDELION">DANDELION</h1></a></li>
<?php
$menu_datas = get_menu_db(0, true);
$gnb_zindex = 999; // gnb_1dli z-index 값 설정용
$i = 0;
foreach( $menu_datas as $row ){
if( empty($row) ) continue;
if($member['mb_level'] < $row['me_level']) continue;
$add_class = (isset($row['sub']) && $row['sub']) ? 'gnb_al_li_plus' : '';
?>
<li class="gnb_1dli <?php echo $add_class; ?>" style="z-index:<?php echo $gnb_zindex--; ?>">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da <?php if($txt == $row['me_name']||strpos(end(explode($s20, G5_BBS_URL.'/board.php?bo_table='.$bo_table)),end(explode($s20, $row['me_link']))) !== false||end(explode($s20, $row['me_link']))==$co_id||end(explode('=', $row['me_link']))==$go_url){$txtx = $row['me_link'];$txt = $row['me_name'];?>on<?php }?>"><?php echo $row['me_name']; ?></a>
<?php
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if( empty($row2) ) continue;
if($member['mb_level'] < $row2['me_level']) continue;
if($k == 0)
echo '<span class="bg"></span><div class="gnb_2dul"><ul class="gnb_2dul_box">'.PHP_EOL;
?>
<li class="gnb_2dli"><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="gnb_2da <?php if($txt2 == $row2['me_name']||end(explode($s20,$row2['me_link']))==$board['bo_table']||end(explode($s20, $row2['me_link']))==$co_id||end(explode('=', $row2['me_link']))==$go_url){$txt2 = $row2['me_name'];$txty = $row2['me_link'];?>on<?php } ?>"><?php echo $row2['me_name']; ?></a></li>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</ul></div>'.PHP_EOL;
?>
</li>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
<li style="float:right;cursor:pointer;display:flex;align-items:center;z-index:11"><?php include_once(G5_THEME_PATH.'/page/googletrans.php');?></li>
</ul>
<div id="gnb_all">
<!--h2>전체메뉴</h2-->
<ul class="gnb_al_ul"><li class="gnb_al_li" style="width:150px">
<a class="gnb_al_a <?php if($co_id=='command'||$co_id=='company'||$co_id=='privacy'||$co_id=='provision')echo 'on'; ?>" href="<?php echo G5_URL; ?>/bbs/content.php?co_id=command">PHP 코드 시험</a>
<p style="line-height:0px"><a class="gnb_al_aa <?php if($co_id=='company')echo 'on'; ?>" href="<?php echo G5_URL; ?>/bbs/content.php?co_id=company">회사소개</a></p>
<p style="line-height:0px"><a class="gnb_al_aa <?php if($co_id=='history')echo 'on'; ?>" href="<?php echo G5_URL; ?>/bbs/content.php?co_id=history">회사연혁</a></p>
<p style="line-height:0px"><a class="gnb_al_aa <?php if($co_id=='privacy')echo 'on'; ?>" href="<?php echo G5_URL; ?>/bbs/content.php?co_id=privacy">개인정보취급방침</a></p>
<p style="line-height:0px"><a class="gnb_al_aa <?php if($co_id=='provision')echo 'on'; ?>" href="<?php echo G5_URL; ?>/bbs/content.php?co_id=provision">서비스 이용약관</a></p></li>
<?php
$i = 0;
foreach( $menu_datas as $row ){
if($member['mb_level'] < $row['me_level']) continue;
?>
<li class="gnb_al_li">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_al_a <?php if($txt == $row['me_name']||strpos(end(explode($s20, G5_BBS_URL.'/board.php?bo_table='.$bo_table)),end(explode($s20, $row['me_link']))) !== false||end(explode($s20, $row['me_link']))==$co_id||end(explode('=', $row['me_link']))==$go_url){$txtx = $row['me_link'];$txt = $row['me_name'];?>on<?php }?>"><?php echo $row['me_name']; ?></a>
<?php
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if($member['mb_level'] < $row2['me_level']) continue;
if($k == 0)
echo '<ul>'.PHP_EOL;
?>
<li><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="<?php if($txt2 == $row2['me_name']||end(explode($s20,$row2['me_link']))==$board['bo_table']||end(explode($s20, $row2['me_link']))==$co_id||end(explode('=', $row2['me_link']))==$go_url){$txt2 = $row2['me_name'];$txty = $row2['me_link'];?>on<?php } ?>"><?php echo $row2['me_name']; ?></a></li>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <br><a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
</ul>
<!--button type="button" class="gnb_close_btn"><i class="fa fa-times" aria-hidden="true"></i></button-->
</div>
<div id="gnb_all_bg"></div>
</div>
</nav>
메인페이지에서도 on 이 되게하고싶습니다.
로고 home 게시판 게시판 게시판
현재 주신건 게시판 및 서브페이지 에서만 적용이되어 메인페이지에 적용하는방법이 궁금합니다.!!
그리고 요즘 버전에는 다음 것으로 사용합니다.
<nav id="gnb" style="clear:both;z-index:999999">
<h2>메인메뉴</h2>
<div class="gnb_wrap">
<ul id="gnb_1dul">
<li class="gnb_1dli gnb_mnal"><button type="button" class="gnb_menu_btn" title="전체메뉴"><i class="fa fa-bars" aria-hidden="true"></i> 전체보기 <span class="sound_only">전체메뉴열기</span></button></li>
<?php
$menu_datas = get_menu_db(0, true);
$gnb_zindex = 999; // gnb_1dli z-index 값 설정용
$i = 0;
foreach( $menu_datas as $row ){
if( empty($row) ) continue;
$add_class = (isset($row['sub']) && $row['sub']) ? 'gnb_al_li_plus' : '';
?>
<li class="gnb_1dli <?php echo $add_class; ?>" style="z-index:<?php echo $gnb_zindex--; ?>">
<?php if(is_mobile()){ ?>
<a <?php if($row['sub'][0]=='') {echo "href=\"".$row['me_link']."\" target=\"_".$row['me_target']."\"";} else {echo 'href="#"';}?> class="gnb_1da <?php if(strpos(basename($bo_table),basename($row['me_link'])) !== false){echo 'on'; }?>"><?php echo $row['me_name'] ?></a>
<?php } else { ?>
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da <?php if(strpos(basename($bo_table),basename($row['me_link'])) !== false){echo 'on'; }?>"><?php echo $row['me_name'] ?></a>
<?php }
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if( empty($row2) ) continue;
if($k == 0)
echo '<span class="bg">하위분류</span><div class="gnb_2dul"><ul class="gnb_2dul_box">'.PHP_EOL;
?>
<?php if(is_mobile() && $k == 0){ ?><a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_2da"><?php echo $row['me_name'] ?></a><?php } ?>
<li class="gnb_2dli"><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="gnb_2da <?php if(basename($_SERVER['REQUEST_URI'], '')==basename($row2['me_link'], '')||basename($row2['me_link'])==$board['bo_table']){echo 'on'; }?>"><?php echo $row2['me_name'] ?></a></li>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</ul></div>'.PHP_EOL;
?>
</li>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
<li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
</ul>
<div id="gnb_all">
<h2>전체메뉴</h2>
<ul class="gnb_al_ul">
<?php
$i = 0;
foreach( $menu_datas as $row ){
?>
<li class="gnb_al_li">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_al_a <?php if($bo_table){if(strpos($_SERVER['REQUEST_URI'],$row[me_link]) !== false){?>on<?php }} else if(strpos($row['me_link'], $_SERVER['PHP_SELF']) !== false){?>on<?php } ?>"><?php echo $row['me_name'] ?></a>
<?php
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if($k == 0)
echo '<ul>'.PHP_EOL;
?>
<li><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="gnb_al_b <?php if(basename($_SERVER['REQUEST_URI'], '')==basename($row2['me_link'], '')||basename($row2['me_link'])==$board['bo_table']){echo 'on'; }?>"><?php echo $row2['me_name'] ?></a></li>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</ul>'.PHP_EOL;
?>
</li>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
</ul>
<button type="button" class="gnb_close_btn"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>
<div id="gnb_all_bg"></div>
</div>
</nav>
<nav>
여기 내용 볼 수 있습니까?
</nav>
<nav class="global-nav" style="clear:both;z-index:999999">
<h2 style="display:none">메인메뉴</h2>
<div class="global-nav-list">
<?php
$menu_datas = get_menu_db(0, true);
$gnb_zindex = 999; // gnb_1dli z-index 값 설정용
$i = 0;
foreach( $menu_datas as $row ){
if( empty($row) ) continue;
$add_class = (isset($row['sub']) && $row['sub']) ? 'gnb_al_li_plus' : '';
?>
<div class="global-nav-item">
<strong class="page-name <?php echo $add_class; ?>" style="z-index:<?php echo $gnb_zindex--; ?>">
<?php if(is_mobile()){ ?>
<a <?php if($row['sub'][0]=='') {echo "href=\"".$row['me_link']."\" target=\"_".$row['me_target']."\"";} else {echo 'href="#"';}?> class=" <?php if(strpos(basename($bo_table),basename($row['me_link'])) !== false){echo 'on'; }?>"><?php echo $row['me_name'] ?></a>
<?php } else { ?>
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class=" <?php if(strpos(basename($bo_table),basename($row['me_link'])) !== false){echo 'on'; }?>"><?php echo $row['me_name'] ?></a>
<?php }
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if( empty($row2) ) continue;
if($k == 0)
echo '<span class="bg" style="display:none">하위분류</span><div class="gnb_2dul"><div class="gnb_2dul_box">'.PHP_EOL;
?>
<?php if(is_mobile() && $k == 0){ ?><a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_2da"><?php echo $row['me_name'] ?></a><?php } ?>
<div class="global-nav-item">
<strong class="gnb_2dli"><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="gnb_2da <?php if(basename($_SERVER['REQUEST_URI'], '')==basename($row2['me_link'], '')||basename($row2['me_link'])==$board['bo_table']){echo 'on'; }?>"><?php echo $row2['me_name'] ?></a></strong></div>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</div></div>'.PHP_EOL;
?>
</strong></div>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
<div class="global-nav-item"> <strong class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></strong></div>
<?php } ?>
</div>
<div id="gnb_all">
<h2>전체메뉴</h2>
<div class="gnb_al_ul">
<?php
$i = 0;
foreach( $menu_datas as $row ){
?>
<div class="global-nav-item">
<strong class="gnb_al_li">
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_al_a <?php if($bo_table){if(strpos($_SERVER['REQUEST_URI'],$row[me_link]) !== false){?>on<?php }} else if(strpos($row['me_link'], $_SERVER['PHP_SELF']) !== false){?>on<?php } ?>"><?php echo $row['me_name'] ?></a>
<?php
$k = 0;
foreach( (array) $row['sub'] as $row2 ){
if($k == 0)
echo '<div>'.PHP_EOL;
?>
<div class="global-nav-item">
<strong><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="gnb_al_b <?php if(basename($_SERVER['REQUEST_URI'], '')==basename($row2['me_link'], '')||basename($row2['me_link'])==$board['bo_table']){echo 'on'; }?>"><?php echo $row2['me_name'] ?></a></strong></div>
<?php
$k++;
} //end foreach $row2
if($k > 0)
echo '</div>'.PHP_EOL;
?>
</strong></div>
<?php
$i++;
} //end foreach $row
if ($i == 0) { ?>
메뉴 준비 중입니다.<?php if ($is_admin) { ?> <a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 > 환경설정 > 메뉴설정</a>에서 설정하실 수 있습니다.<?php } ?></li>
<?php } ?>
</div>
<button type="button" class="gnb_close_btn"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>
<div id="gnb_all_bg"></div>
</div>
</nav>
제가 올린 내용과는 조금 다른 내용입니다.
$row['me_name'] == '라라마케팅'&&$_SERVER['REQUEST_URI']=='/?'이렇게 조건에 추가 하세요.
head.php
<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class=" <?php if(strpos(basename($bo_table),basename($row['me_link'])) !== false||$row['me_name'] == '라라마케팅'&&$_SERVER['REQUEST_URI']=='/?'){echo 'on'; }?>"><?php echo $row['me_name'] ?></a>