최신게시물 탭메뉴를 사용하는데 한페이지에 2개 못 넣나요?

최신게시물 탭메뉴를 사용하는데 한페이지에 2개 못 넣나요?

QA

최신게시물 탭메뉴를 사용하는데 한페이지에 2개 못 넣나요?

본문

탭메뉴 스킨 원글

 

http://sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=144095&sca=%EC%B5%9C%EC%8B%A0%EA%B8%80&sfl=wr_subject%7C%7Cwr_content&stx=%ED%83%AD%EB%A9%94%EB%89%B4

 

4개씩 들어가는 탭메뉴인데 이것을 각 다른 게시판별로 한페이지에 2개를 넣고 싶어요

 

bada_tab.php를 변형하여 bada_tab_2.php를 따로 만들어 올렸고

 

bada_tab.php나  bada_tab_2.php 하나만 삽입하면 제대로 작동하는데

동시에 두개가 들어가면 

탭이 움직이지 않는 등 제대로 작동하지 않아요

 

해결할 방법 없나요?

 

 

*** 그리고 bada_tab_2.php 같은 경우, 기존의 탭 ID 1~4의 숫자만 5~8로 수정하였습니다

 

어느 부분이 문제일까요? 꼭 알려주시길 부탁드립니다ㅠㅠ

 

bada_tab.php

 

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");


$tab_img = "{$g4[path]}/tab_img"; //이미지 경로

$tab_width = "370"; //탭메뉴 폭

$tab_gr = "group"; //그룹명  또는 아무끼나 맴대루

$tab_bo1 = "notice"; //처음 출력될 게시판 ID
$tab_bo2 = "data"; //공지 게시판  ID
$tab_bo3 = "real"; //질답 게시판  ID
$tab_bo4 = "fanbook"; //질답 게시판  ID
?>
<head>
<script language="javascript">
function tab_img_change(t){
    for(var i = 1; i <= 4; i++) {
   img = document.getElementById('tab_bar'+i);
   img.src = "<?=$tab_img?>/tab"+i+"_off.gif";  
    eval("document.getElementById('tab_view"+i+"')").style.display="none";

   if ( t == i ) {
    img.src = "<?=$tab_img?>/tab"+i+"_on.gif";
    eval("document.getElementById('tab_view"+i+"')").style.display="";
   }        
    }    
 }
</script>

<style>
.la  {  font-family:굴림; font-size:9pt;  color:#636363;}
</style>
</head>

<table width='<?=$tab_width?>' cellpadding=0 cellspacing=0 border=0>
<tr>

 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo1?>">
 <img id="tab_bar1" style="cursor:pointer;" onMouseOver="tab_img_change(1)" src="<?=$tab_img?>/tab1_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo2?>">
 <img id="tab_bar2" style="cursor:pointer;" onMouseOver="tab_img_change(2)" src="<?=$tab_img?>/tab2_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo3?>">
 <img id="tab_bar3" style="cursor:pointer;" onMouseOver="tab_img_change(3)" src="<?=$tab_img?>/tab3_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo4?>">
 <img id="tab_bar4" style="cursor:pointer;" onMouseOver="tab_img_change(4)" src="<?=$tab_img?>/tab4_off.gif" width="76" height="45" border="0">
 </a>
 </td>
<td width='<?=$tab_width-296?>' background='<?=$tab_img?>/tabbar_bg.gif' style='padding-top:3px;' class='la'><b><?//=$tab_gr?></b></td> 
</tr>
 <tr>
  <td colspan='5'>
   <div id="tab_view1">
        <?=latest('bara_latest',$tab_bo1, 5, 100); //제목길이는 최신글 스킨에서 수정요 ?>
   </div>
   <div id="tab_view2" style="display: none">
        <?=latest('bara_latest',$tab_bo2, 5, 100);?>
   </div>
   <div id="tab_view3" style="display: none">
        <?=latest('bara_latest',$tab_bo3, 5, 100);?>
   </div>
   <div id="tab_view4" style="display: none">
        <?=latest('bara_latest',$tab_bo4, 5, 100);?>
   </div>
    </td>
 </tr>
</table>
<script>
tab_img_change(1);
</script>​

 

 

 

 

bada_tab_2.php

 

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");


$tab_img = "{$g4[path]}/tab_img"; //이미지 경로

$tab_width = "370"; //탭메뉴 폭

$tab_gr = "group"; //그룹명  또는 아무끼나 맴대루

$tab_bo5 = "fanfic"; //처음 출력될 게시판 ID
$tab_bo6 = "ssul"; //공지 게시판  ID
$tab_bo7 = "hof"; //질답 게시판  ID
$tab_bo8 = "secret2"; //질답 게시판  ID
?>
<head>
<script language="javascript">
function tab_img_change(t){
    for(var i = 1; i <= 10; i++) {
   img = document.getElementById('tab_bar'+i);
   img.src = "<?=$tab_img?>/tab"+i+"_off.gif";  
    eval("document.getElementById('tab_view"+i+"')").style.display="none";

   if ( t == i ) {
    img.src = "<?=$tab_img?>/tab"+i+"_on.gif";
    eval("document.getElementById('tab_view"+i+"')").style.display="";
   }        
    }    
 }
</script>

<style>
.la  {  font-family:굴림; font-size:9pt;  color:#636363;}
</style>
</head>

<table width='<?=$tab_width?>' cellpadding=0 cellspacing=0 border=0>
<tr>

 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo5?>">
 <img id="tab_bar5" style="cursor:pointer;" onMouseOver="tab_img_change(5)" src="<?=$tab_img?>/tab5_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo6?>">
 <img id="tab_bar6" style="cursor:pointer;" onMouseOver="tab_img_change(6)" src="<?=$tab_img?>/tab6_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo7?>">
 <img id="tab_bar7" style="cursor:pointer;" onMouseOver="tab_img_change(7)" src="<?=$tab_img?>/tab7_off.gif" width="76" height="45" border="0">
 </a>
 </td>
 <td width=76 background='<?=$tab_img?>/tabbar_bg.gif'>
 <a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo8?>">
 <img id="tab_bar8" style="cursor:pointer;" onMouseOver="tab_img_change(8)" src="<?=$tab_img?>/tab8_off.gif" width="76" height="45" border="0">
 </a>
 </td>
<td width='<?=$tab_width-296?>' background='<?=$tab_img?>/tabbar_bg.gif' style='padding-top:3px;' class='la'><b><?//=$tab_gr?></b></td> 
</tr>
 <tr>
  <td colspan='5'>
   <div id="tab_view5">
        <?=latest('bara_latest',$tab_bo5, 5, 100); //제목길이는 최신글 스킨에서 수정요 ?>
   </div>
   <div id="tab_view6" style="display: none">
        <?=latest('bara_latest',$tab_bo6, 5, 100);?>
   </div>
   <div id="tab_view7" style="display: none">
        <?=latest('bara_latest',$tab_bo7, 5, 100);?>
   </div>
   <div id="tab_view8" style="display: none">
        <?=latest('bara_latest',$tab_bo8, 5, 100);?>
   </div>
    </td>
 </tr>
</table>
<script>
tab_img_change(5);
</script>​

이 질문에 댓글 쓰기 :

답변 2

그렇게 이어지게하면 관리하기 번거로우실텐데 아예 그냥 2개 분리시키시는게 낫지 않나요.

아래 코드 그대로 복사해서 bada_tab2.php 로 해보세요.

이미지 폴더는 tab_img2 로 만들어서 하시고..

 


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
 
include_once("./_common.php");
include_once("$g4[path]/lib/latest.lib.php");
 
 
$tab_img = "{$g4[path]}/tab_img2"; //이미지 경로
 
$tab_width = "360"; //탭메뉴 폭
 
$tab_gr = "group"; //그룹명  또는 아무끼나 맴대루
 
$tab_bo1 = "1111"; //처음 출력될 게시판 ID
$tab_bo2 = "bbs1"; //공지 게시판  ID
$tab_bo3 = "1111"; //질답 게시판  ID
$tab_bo4 = "bbs1"; //질답 게시판  ID
?>
<head>
<script language="javascript">
function tab_img_changeb(t){
	   for(var i = 1; i <= 4; i++) {
		 img = document.getElementById('tab_barb'+i);
		 img.src = "<?=$tab_img?>/tab"+i+"_off.gif";   
		  eval("document.getElementById('tab_viewb"+i+"')").style.display="none";
 
		 if ( t == i ) {
		  img.src = "<?=$tab_img?>/tab"+i+"_on.gif"; 
		  eval("document.getElementById('tab_viewb"+i+"')").style.display="";
		 }         
	   }     
	}
</script>
 
<style>
.la  {  font-family:굴림; font-size:9pt;  color:#636363;}
</style>
</head>
 
<table width='<?=$tab_width?>' cellpadding=0 cellspacing=0 border=0>
<tr>
 
	<td width=74 background='<?=$tab_img?>/tabbar_bg.gif'>
	<a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo1?>">
	<img id="tab_barb1" style="cursor:pointer;" onMouseOver="tab_img_changeb(1)" src="<?=$tab_img?>/tab1_off.gif" width="74" height="26" border="0">
	</a>
	</td>
	<td width=74 background='<?=$tab_img?>/tabbar_bg.gif'>
	<a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo2?>">
	<img id="tab_barb2" style="cursor:pointer;" onMouseOver="tab_img_changeb(2)" src="<?=$tab_img?>/tab2_off.gif" width="74" height="26" border="0">
	</a>
	</td>
	<td width=74 background='<?=$tab_img?>/tabbar_bg.gif'>
	<a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo3?>">
	<img id="tab_barb3" style="cursor:pointer;" onMouseOver="tab_img_changeb(3)" src="<?=$tab_img?>/tab3_off.gif" width="74" height="26" border="0">
	</a>
	</td>
	<td width=74 background='<?=$tab_img?>/tabbar_bg.gif'>
	<a href="<?=$g4['bbs_path']?>/board.php?bo_table=<?=$tab_bo4?>">
	<img id="tab_barb4" style="cursor:pointer;" onMouseOver="tab_img_changeb(4)" src="<?=$tab_img?>/tab4_off.gif" width="74" height="26" border="0">
	</a>
	</td>
<td width='<?=$tab_width-296?>' background='<?=$tab_img?>/tabbar_bg.gif' style='padding-top:3px;' class='la'><b><?//=$tab_gr?></b></td>	
</tr>
	<tr>
		<td colspan='5'>
			<div id="tab_viewb1">
  			   <?=latest('bara_latest',$tab_bo1, 4, 100); //제목길이는 최신글 스킨에서 수정요 ?>
			</div>
			<div id="tab_viewb2" style="display: none">
  			   <?=latest('bara_latest',$tab_bo2, 4, 100);?>
			</div>
			<div id="tab_viewb3" style="display: none">
  			   <?=latest('bara_latest',$tab_bo3, 4, 100);?>
			</div>
			<div id="tab_viewb4" style="display: none">
  			   <?=latest('bara_latest',$tab_bo4, 4, 100);?>
			</div>
		  </td>
	</tr>
</table>
<script>
tab_img_changeb(1);
</script> 
답변을 작성하시기 전에 로그인 해주세요.
전체 123,881 | RSS
QA 내용 검색

회원로그인

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