최근 게시물을 자동 탭메뉴 방식으로 만들기
들어가기전........
주특기가 눈팅 전문인 초보 짜집퍼가 만들어본 것이므로 최적화를
부탁드리며 돌맞을 각오하고 올려 봅니다.
디자인도 없으므로 최적화가 되면 이쁘게 디자인도 부탁드립니다.^^;
이름하여 자동 탭메뉴 방식 최근 게시물 입니다.ㅡㅡ;ㅋ
방법은 아래의 코드를 긁어서 사용하시고 수정할곳이 한군데 있습니다.
하단부에 있는 <?=latest('abc',$row3[bo_table], 10, 80);?> 이부분에서
abc 를 사용중인 최근 게시물 스킨 이름으로 넣어 주세요.
================자동 탭메뉴===========
<table width="520" border="1" cellpadding=5 cellspacing=5>
<tr>
<td valign=top>
<b>전체 게시판용 자동 탭메뉴 방식 최근게시물 테스트 입니다.</b>
</td>
</tr>
</table>
<!-- 메인화면 자동 탭메뉴 방식 최신글 by 헐랭이-->
<SCRIPT type=text/javascript>
<!--
old_debate='1';
function showLayer(objid){
document.getElementById("debate"+old_debate).style.display="none";
document.getElementById("debate"+old_debate+"#1").style.display="";
document.getElementById("debate"+objid+"#1").style.display="none";
document.getElementById("debate"+objid).style.display="";
document.getElementById("debate_content"+old_debate).style.display="none";
document.getElementById("debate_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
<table width="500" border="1" cellspacing="4" cellpadding="5">
<tr>
<td>
<table width="500" border="1" cellspacing="3" cellpadding="5">
<tr>
<?
// 사이트내의 전체 게시판을 불러온다. 탭메뉴 리스트의 출력에서 제외하고 싶은 게시판이 있다면
// ('board1111', 'board2222', 'board3333', 'board4444') 이안에 제외시킬 갯수만큼 주~욱 나열한다.
$sql2 = " select bo_table, bo_subject from $g4[board_table] where bo_table not in ('board1111', 'board2222', 'board3333', 'board4444') order by gr_id, bo_table ";
//특정 그룹만 출력할 경우 아래처럼 한다.
//$sql2 = " select bo_table, bo_subject from $g4[board_table] where gr_id = 'community' and bo_list_level <= '$member[mb_level]' order by bo_table ";
$result2 = sql_query($sql2);
for ($ik=1; $row2=sql_fetch_array($result2); $ik++) {
//출력된 리스트중 1번일 때에는 기본으로 활성화 시킨다.
if ($ik==1) {
$acbcbs ="<TD bgcolor='#B5D3E8' id=debate{$ik}><A href='$g4[bbs_path]/board.php?bo_table=$row2[bo_table]' title='$row2[bo_table] 바로가기' onfocus='this.blur()'><font color=#ff9966>▷$row2[bo_subject]</font></A></TD>";
$acbcbsd ="<TD id=debate{$ik}#1 style=\"DISPLAY: none;\"><A href=\"javascript:showLayer('{$ik}')\" title='미리보기' onfocus='this.blur()'>$row2[bo_subject]</A></TD>";
} else {
$acbcbs ="<TD bgcolor='#B5D3E8' id=debate{$ik} style=\"DISPLAY: none;\"><A href='$g4[bbs_path]/board.php?bo_table=$row2[bo_table]' title='$row2[bo_table] 바로가기' onfocus='this.blur()'><font color=#ff9966>▷$row2[bo_subject]</font></A></A></TD>";
$acbcbsd ="<TD id=debate{$ik}#1><A href=\"javascript:showLayer('{$ik}')\" title='미리보기' onfocus='this.blur()'>$row2[bo_subject]</A></TD>";
}
// 가로 배열로 4개씩 잘라서 탭메뉴의 리스트를 나열하며 갯수를 3개 또는 5개로 할경우 수정한다.
// 현재 52개 까지만 지원되며 갯수를 추가시 아래의 코드를 참조하여 추가한다.
if ($ik < 5) {
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 9)
{
if ($ik==5) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 13)
{
if ($ik==9) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 17)
{
if ($ik==13) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 21)
{
if ($ik==17) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 25)
{
if ($ik==21) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 29)
{
if ($ik==25) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 33)
{
if ($ik==25) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 37)
{
if ($ik==33) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 41)
{
if ($ik==33) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 45)
{
if ($ik==41) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 49)
{
if ($ik==45) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else
{
if ($ik==49) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
}
?>
</tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<colgroup width='1'>
<colgroup>
<colgroup width='1'>
<tr>
<td bgcolor='#D5D3E8'></td>
<td bgcolor='#FFFFFF' valign='top'>
<?
//레이어갯수와 번호를 할당하기 위해서 별도로 for문을 한번더 돌린다.ㅋ
$result3 = sql_query($sql2);
for ($ikc=1; $row3=sql_fetch_array($result3); $ikc++) {
if ($ikc==1) { $acbcb ="";}else{ $acbcb =" style=\"DISPLAY: none;\""; }
?>
<DIV id=debate_content<?=$ikc?><?=$acbcb?>>
<?=latest('abc',$row3[bo_table], 10, 80);?></DIV>
<?}?>
</td>
<td bgcolor='#D5D3E8'></td>
</tr>
<tr><td colspan='3' bgcolor='#D5D3E8'></td></tr>
</table>
</td></tr>
</table>
<!-- 자동 탭메뉴 최신글 끝 -->
==================끝==============
미리보기 : http://kkk.myhome.tv/gnu/
제 컴터 이므로 접속이 원활하지 않을수도 있으며 접속이 안될경우
이슬이랑 눈맞아서 놀거나 컴퓨터 전원이 꺼진 상태 이므로 참고 하세요.ㅡ,.ㅡ;
주특기가 눈팅 전문인 초보 짜집퍼가 만들어본 것이므로 최적화를
부탁드리며 돌맞을 각오하고 올려 봅니다.
디자인도 없으므로 최적화가 되면 이쁘게 디자인도 부탁드립니다.^^;
이름하여 자동 탭메뉴 방식 최근 게시물 입니다.ㅡㅡ;ㅋ
방법은 아래의 코드를 긁어서 사용하시고 수정할곳이 한군데 있습니다.
하단부에 있는 <?=latest('abc',$row3[bo_table], 10, 80);?> 이부분에서
abc 를 사용중인 최근 게시물 스킨 이름으로 넣어 주세요.
================자동 탭메뉴===========
<table width="520" border="1" cellpadding=5 cellspacing=5>
<tr>
<td valign=top>
<b>전체 게시판용 자동 탭메뉴 방식 최근게시물 테스트 입니다.</b>
</td>
</tr>
</table>
<!-- 메인화면 자동 탭메뉴 방식 최신글 by 헐랭이-->
<SCRIPT type=text/javascript>
<!--
old_debate='1';
function showLayer(objid){
document.getElementById("debate"+old_debate).style.display="none";
document.getElementById("debate"+old_debate+"#1").style.display="";
document.getElementById("debate"+objid+"#1").style.display="none";
document.getElementById("debate"+objid).style.display="";
document.getElementById("debate_content"+old_debate).style.display="none";
document.getElementById("debate_content"+objid).style.display="";
old_debate=objid;
}
//-->
</SCRIPT>
<table width="500" border="1" cellspacing="4" cellpadding="5">
<tr>
<td>
<table width="500" border="1" cellspacing="3" cellpadding="5">
<tr>
<?
// 사이트내의 전체 게시판을 불러온다. 탭메뉴 리스트의 출력에서 제외하고 싶은 게시판이 있다면
// ('board1111', 'board2222', 'board3333', 'board4444') 이안에 제외시킬 갯수만큼 주~욱 나열한다.
$sql2 = " select bo_table, bo_subject from $g4[board_table] where bo_table not in ('board1111', 'board2222', 'board3333', 'board4444') order by gr_id, bo_table ";
//특정 그룹만 출력할 경우 아래처럼 한다.
//$sql2 = " select bo_table, bo_subject from $g4[board_table] where gr_id = 'community' and bo_list_level <= '$member[mb_level]' order by bo_table ";
$result2 = sql_query($sql2);
for ($ik=1; $row2=sql_fetch_array($result2); $ik++) {
//출력된 리스트중 1번일 때에는 기본으로 활성화 시킨다.
if ($ik==1) {
$acbcbs ="<TD bgcolor='#B5D3E8' id=debate{$ik}><A href='$g4[bbs_path]/board.php?bo_table=$row2[bo_table]' title='$row2[bo_table] 바로가기' onfocus='this.blur()'><font color=#ff9966>▷$row2[bo_subject]</font></A></TD>";
$acbcbsd ="<TD id=debate{$ik}#1 style=\"DISPLAY: none;\"><A href=\"javascript:showLayer('{$ik}')\" title='미리보기' onfocus='this.blur()'>$row2[bo_subject]</A></TD>";
} else {
$acbcbs ="<TD bgcolor='#B5D3E8' id=debate{$ik} style=\"DISPLAY: none;\"><A href='$g4[bbs_path]/board.php?bo_table=$row2[bo_table]' title='$row2[bo_table] 바로가기' onfocus='this.blur()'><font color=#ff9966>▷$row2[bo_subject]</font></A></A></TD>";
$acbcbsd ="<TD id=debate{$ik}#1><A href=\"javascript:showLayer('{$ik}')\" title='미리보기' onfocus='this.blur()'>$row2[bo_subject]</A></TD>";
}
// 가로 배열로 4개씩 잘라서 탭메뉴의 리스트를 나열하며 갯수를 3개 또는 5개로 할경우 수정한다.
// 현재 52개 까지만 지원되며 갯수를 추가시 아래의 코드를 참조하여 추가한다.
if ($ik < 5) {
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 9)
{
if ($ik==5) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 13)
{
if ($ik==9) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 17)
{
if ($ik==13) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 21)
{
if ($ik==17) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 25)
{
if ($ik==21) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 29)
{
if ($ik==25) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 33)
{
if ($ik==25) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 37)
{
if ($ik==33) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 41)
{
if ($ik==33) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 45)
{
if ($ik==41) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else if ($ik < 49)
{
if ($ik==45) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
else
{
if ($ik==49) {
echo "</tr><tr>";
}
?>
<td width="120">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TR>
<?=$acbcbs?>
<?=$acbcbsd?>
</TR></TABLE></td>
<?
}
}
?>
</tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<colgroup width='1'>
<colgroup>
<colgroup width='1'>
<tr>
<td bgcolor='#D5D3E8'></td>
<td bgcolor='#FFFFFF' valign='top'>
<?
//레이어갯수와 번호를 할당하기 위해서 별도로 for문을 한번더 돌린다.ㅋ
$result3 = sql_query($sql2);
for ($ikc=1; $row3=sql_fetch_array($result3); $ikc++) {
if ($ikc==1) { $acbcb ="";}else{ $acbcb =" style=\"DISPLAY: none;\""; }
?>
<DIV id=debate_content<?=$ikc?><?=$acbcb?>>
<?=latest('abc',$row3[bo_table], 10, 80);?></DIV>
<?}?>
</td>
<td bgcolor='#D5D3E8'></td>
</tr>
<tr><td colspan='3' bgcolor='#D5D3E8'></td></tr>
</table>
</td></tr>
</table>
<!-- 자동 탭메뉴 최신글 끝 -->
==================끝==============
미리보기 : http://kkk.myhome.tv/gnu/
제 컴터 이므로 접속이 원활하지 않을수도 있으며 접속이 안될경우
이슬이랑 눈맞아서 놀거나 컴퓨터 전원이 꺼진 상태 이므로 참고 하세요.ㅡ,.ㅡ;
|
댓글을 작성하시려면 로그인이 필요합니다.
로그인
댓글 13개
신묘한 작품을 공개해 주셨네요.
곧 서버세팅 관련 팁을 올려주시지 않을까? 기대해 봅니다.^^;
탭메뉴 최근게시물 스킨을 짜집기로 확장을 하다보니
요상한 물건이 나온거랍니다.ㅡㅡㅋ
유창화님 블로그에 링크된 문서인데 요즈음 prototype.js 이게 여기저기서 자주 보입니다.
http://openframework.or.kr/framework_reference/prototype_js/1.4.0/prototype.js.html
아래 `그여인`께서 제안하신 형태도 매력있어 보입니다.^^;
하지만 저한테는 너무나도 멀고도 험난하게만 보입니다.ㅡㅡ;ㅋ
위 소스를 변형해서 특정게시판(한개의 게시판)에서 카테고리 여러개가 있을 경우,
카테고리들을 위처럼 탭 형식으로 나오게 하고 그 아래에는 게시물의 제목들을 출력하려면
어떻게 변형시키면 가능할지 요것도 팁으로 좀 올려주실수 있사면 감사하겠습니다.
게시판 하나를 사용하여 북마크사이트로 활용하면 유용할것 같아서 말씀드렸습니다.
좋은 팁 잘 쓰겠습니다.
시간을두고 도전을 해보겠습니다.만
그전에 다른분께서 해결을 해주시면 감사하겠습니다.
참감사합니다...^^
차후에 잘 다듬어져서 최적화 된후에 디자인과 스킨화가 되었으면 하는 바랩입니다.
//특정 그룹만 출력할 경우 gr_id = '그룹명'
//이렇게 하면 지정된 그룹을 출력 합니다.
//$sql2 = " select bo_table, bo_subject from $g4[board_table] where gr_id = 'community' and bo_list_level <= '$member[mb_level]' order by bo_table ";
만약 그룹변수를 사용할 경우 gr_id = '$gr_id' <-이렇게 한후
링크에 그룹명을 넘겨 주면 해당 그룹에 속한 게시판을 가져온후 탭메뉴로 만듭니다.
예제: 홈주소/페이지이름.html?gr_id=그룹명
헐랭이님 도움 많이 받고 있습니다.
감사합니다.