게시판 마다 다른 head.php와 tail.php를 사용할려면? > 그누3질답

그누3질답

게시판 마다 다른 head.php와 tail.php를 사용할려면? 정보

그누보드 게시판 마다 다른 head.php와 tail.php를 사용할려면?

본문

그누보드를 설치한 후
게시판(A 게시판)을 하나 만들었습니다.
그리고 게시판의 상,하단 파일경로를 head.php와 tail.php로 설정하였습니다.
첫화면에는 설치후 head.php와 tail.php가 나오는데(상단의 파란색(?)바탕, 하단에 회색바탕)
그런데 A게시판을 눌렀을경우 다른 색깔로 나오게 할 수 있는 방법을 찾습니다.
head.php와 tail.php를 여러개 만들어 써야하나요?
head.php
-------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

/*
    사용자 화면 상단과 좌측을 담당하는 페이지입니다.
    상단, 좌측 화면을 꾸미려면 이 파일을 수정합니다.
*/
include "./bbs/gblayer.php";
?>

<table width=1000 align=center><tr><td>

<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
    <td height=60>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td><a href='./'><img src='image/logo.gif' border=0 alt='그누보드'></a></td>
        </tr>
        </table>
    </td>
    <td align=right valign=top>
                &nbsp;
                <?
                echo "<a href='./' class=tm>HOME</a> | ";
                if (!$member[mb_id]) {
                    echo "<a href='./?doc=bbs/mblogin.php&url=$urlencode'  class=tm>로그인</a> | ";
                    echo "<a href='./?doc=bbs/mbform.php'  class=tm>회원가입</a>";
                } else {
                    echo "<a href='./?doc=bbs/mblogout.php&url=$urlencode'  class=tm>로그아웃</a> | ";
                    echo "<a href='./?doc=bbs/mbform.php&w=u'  class=tm>정보수정</a>";
                    if ($is_admin == "default" || $is_admin == "group") {
                        echo " <a href='./?doc=bbs/admin/index.php'  class=tm>(ADMIN)</a>";
                    }
                }
                ?>
    </td>
</tr>
<tr>
    <td colspan=2>
        <table width=100%  height=30 cellpadding=0 cellspacing=0>
        <tr>
            <td bgcolor=#217AF9 width=75%>  <---------------------------이부분
                &nbsp;
                <?
                echo "<a href='./' class=tm2>HOME</a>&nbsp;&nbsp; ";
                if (!$member[mb_id]) {
                    echo "<a href='./?doc=bbs/mblogin.php&url=$urlencode'  class=tm2>로그인</a>&nbsp;&nbsp;  ";
                    echo "<a href='./?doc=bbs/mbform.php'  class=tm2>회원가입</a>";
                } else {
                    echo "<a href='./?doc=bbs/mblogout.php&url=$urlencode'  class=tm2>로그아웃</a>&nbsp;&nbsp; ";
                    echo "<a href='./?doc=bbs/mbform.php&w=u'  class=tm2>정보수정</a>";
                    if ($is_admin == "default" || $is_admin == "group") {
                        echo " <a href='./?doc=bbs/admin/index.php'  class=tm2>(ADMIN)</a>";
                    }
                }
                ?>
            </td>
            <td width=25% align=right background='image/bg_search.gif'>
                <!-- 그누보드 외부 검색 폼 -->
                <table cellpadding=0 cellspacing=0>
                <form name=fgnusearch method=get action='<?="./"?>'>
                <tr>
                    <td>
                        <input type='hidden' name='doc'          value='bbs/gnusearch.php'>
                        <input type='hidden' name='sselect'      value='concat(wr_subject,wr_content)'>
                        <input type='hidden' name='soperator'    value='1'>
                        <input type='hidden' name='srch_rows'    value='5'>
                        <input type='hidden' name='srch_comment'  value='1'>
                        <input type='hidden' name='srch_days'    value='0'>

<img src='image/title_search.gif' align=absmiddle> &nbsp;
                        <input type=text class=input name='stext' size=15 required minlength=2 itemname='검색어'>
                        <input type=image src='image/btn_go.gif' border=0 align=absmiddle>&nbsp;&nbsp;
                    </td>
                </tr>
                </form>
                </table>
            </td>
        </tr>
        </table>
    </td>
</tr>
</table>

<table width='100%' cellpadding=0 cellspacing=0>
<colgroup width=170>
<colgroup width=5>
<colgroup width=''>
<tr>
    <!-- 왼쪽 메뉴 부분 -->
    <td valign=top>

        <!-- 외부 로그인 -->
        <? include "./bbs/outlogin.php"; ?>

        <!-- 공백 -->
        <table width=100% height=5><tr><td></td></tr></table>

    </td>
    <td></td>
    <td valign=top>



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

/*
    사용자 화면 상단과 좌측을 담당하는 페이지입니다.
    상단, 좌측 화면을 꾸미려면 이 파일을 수정합니다.
*/
include "./bbs/gblayer.php";
?>

<table width=1000 align=center><tr><td>

<table width=100% cellpadding=0 cellspacing=0 border=0>
<tr>
    <td height=60>
        <table width=100% cellpadding=0 cellspacing=0>
        <tr>
            <td><a href='./'><img src='image/logo.gif' border=0 alt='그누보드'></a></td>
        </tr>
        </table>
    </td>
    <td align=right valign=top>
                &nbsp;
                <?
                echo "<a href='./' class=tm>HOME</a> | ";
                if (!$member[mb_id]) {
                    echo "<a href='./?doc=bbs/mblogin.php&url=$urlencode'  class=tm>로그인</a> | ";
                    echo "<a href='./?doc=bbs/mbform.php'  class=tm>회원가입</a>";
                } else {
                    echo "<a href='./?doc=bbs/mblogout.php&url=$urlencode'  class=tm>로그아웃</a> | ";
                    echo "<a href='./?doc=bbs/mbform.php&w=u'  class=tm>정보수정</a>";
                    if ($is_admin == "default" || $is_admin == "group") {
                        echo " <a href='./?doc=bbs/admin/index.php'  class=tm>(ADMIN)</a>";
                    }
                }
                ?>
    </td>
</tr>
<tr>
    <td colspan=2>
        <table width=100%  height=30 cellpadding=0 cellspacing=0>
        <tr>
            <td bgcolor=#217AF9 width=75%> <---------------------------이부분
                &nbsp;
                <?
                echo "<a href='./' class=tm2>HOME</a>&nbsp;&nbsp; ";
                if (!$member[mb_id]) {
                    echo "<a href='./?doc=bbs/mblogin.php&url=$urlencode'  class=tm2>로그인</a>&nbsp;&nbsp;  ";
                    echo "<a href='./?doc=bbs/mbform.php'  class=tm2>회원가입</a>";
                } else {
                    echo "<a href='./?doc=bbs/mblogout.php&url=$urlencode'  class=tm2>로그아웃</a>&nbsp;&nbsp; ";
                    echo "<a href='./?doc=bbs/mbform.php&w=u'  class=tm2>정보수정</a>";
                    if ($is_admin == "default" || $is_admin == "group") {
                        echo " <a href='./?doc=bbs/admin/index.php'  class=tm2>(ADMIN)</a>";
                    }
                }
                ?>
            </td>
            <td width=25% align=right background='image/bg_search.gif'>
                <!-- 그누보드 외부 검색 폼 -->
                <table cellpadding=0 cellspacing=0>
                <form name=fgnusearch method=get action='<?="./"?>'>
                <tr>
                    <td>
                        <input type='hidden' name='doc'          value='bbs/gnusearch.php'>
                        <input type='hidden' name='sselect'      value='concat(wr_subject,wr_content)'>
                        <input type='hidden' name='soperator'    value='1'>
                        <input type='hidden' name='srch_rows'    value='5'>
                        <input type='hidden' name='srch_comment'  value='1'>
                        <input type='hidden' name='srch_days'    value='0'>

<img src='image/title_search.gif' align=absmiddle> &nbsp;
                        <input type=text class=input name='stext' size=15 required minlength=2 itemname='검색어'>
                        <input type=image src='image/btn_go.gif' border=0 align=absmiddle>&nbsp;&nbsp;
                    </td>
                </tr>
                </form>
                </table>
            </td>
        </tr>
        </table>
    </td>
</tr>
</table>

<table width='100%' cellpadding=0 cellspacing=0>
<colgroup width=170>
<colgroup width=5>
<colgroup width=''>
<tr>
    <!-- 왼쪽 메뉴 부분 -->
    <td valign=top>

        <!-- 외부 로그인 -->
        <? include "./bbs/outlogin.php"; ?>

        <!-- 공백 -->
        <table width=100% height=5><tr><td></td></tr></table>

    </td>
    <td></td>
    <td valign=top>

댓글 전체

아. 그리고 일반 페이지 같은 경우는 indexdoctype 에서 스타일 하나 만들어서 head.php, tail.php 를 불러오게 한 후에 페이지에 들어갈 내용만 코딩해주고 사용합니다.

이렇게 하면, 공통적인 부분이 바뀔 때 head.php 만 바꿔주면 되고. (하단은 tail.php) 각각 서브메뉴를 바꿔줘야 할때는 head_bbs.php 이런 파일들만 바꿔주면 되니까. 관리가 쉽네요.
흐음.. 전부 indexdoctype 로 하는거로는 너무 번잡해서요..
저는 레이아웃중 공통적으로 변하지 않는 부분은 파일 하나로 해놓고, 게시판이나 그룹마다 바껴야 할 부분은 그부분만 코딩해논 파일을 게시판 설정에서 헤더로 지정해 놓고 쓰고 있습니다. 물론 헤더로 설정할 파일 맨 상단에 include 문으로 공통적인 부분을 불러오는것 잊지 말고요.
ex ) 제 홈페이지 보면 공통적으로 젤 상단의 버튼들 포함된 부분은 head.php로 잡고. 그외 왼쪽옆의 서브메뉴가 들어갈 부분은 head_bbs.php , head_diary.php 이런식으로 만들어서 헤더로 지정해 놓고 쓰고 있습니다.
그 파일들 안에는 제일 상단에 include "./head.php"; 문이 들어있고요. indoctype 으로 지정해 놓는건 일반 페이지이나 게시판에서 윤활하게 적용하기가 힘들어서요.
indexdoctype.php에서...수정하시고

head.php와 tail.php 에서처럼 상단에 정의한거

새로 만든 헤드와 테일에 똑같이 적용하면 됩니다...

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

/*
    사용자 화면 상단과 좌측을 담당하는 페이지입니다.
    상단, 좌측 화면을 꾸미려면 이 파일을 수정합니다.
*/
include "./bbs/gblayer.php";
?>

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

/*
    사용자 화면 우측과 하단을 담당하는 페이지입니다.
    우측, 하단 화면을 꾸미려면 이 파일을 수정합니다.
*/
?>


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

// 3.35 : index.php 에서 분리
//
// 페이지의 DOCTYPE 에 따라 include 를 결정함
//
switch (_DOCTYPE_) {
    // NONE 는 상단과 하단 파일이 필요없는 TYPE
    case "NONE" :
        echo $ob_content;
        break;
    // STYLE 은 stylesheet 등만 적용하는 TYPE
    case "STYLE" :
        include './head.sub.php';
        echo $ob_content;
        include './tail.sub.php';
        break;
    // DESIGN 은 상단, 하단 파일을 필요로 하는 TYPE
    case "DESIGN" :
        include './head.sub.php';
        include './head.php';
        echo $ob_content;
        include './tail.php';
        include './tail.sub.php';
        break;
// DESIGN 은 상단, 하단 파일을 필요로 하는 TYPE
    case "DESIGN1" :
        include './head.sub.php';
        include './head1.php';
        echo $ob_content;
        include './tail1.php';
        include './tail.sub.php';
        break;
// DESIGN 은 상단, 하단 파일을 필요로 하는 TYPE
    case "DESIGN2" :
        include './head.sub.php';
        include './head2.php';
        echo $ob_content;
        include './tail2.php';
        include './tail.sub.php';
        break;
// 여기서 마음대로 변경할수 있습니다....
    // 나머지 TYPE 은 오류
    default :
        if (!file_exists($doc) && $doc) {
            echo "$doc 파일이 존재하는지 확인하여 주십시오.";
            exit;
        }
        echo "_DOCTYPE_ 오류 : NONE , STYLE , DESIGN 중 하나를 사용하세요.<p>";
        echo $ob_content;
        break;
}
?>
전체 9,564
그누3질답 내용 검색

회원로그인

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