너무 어려워요~ > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

너무 어려워요~ 정보

너무 어려워요~

본문

안녕하세요~

그누보드 초보입니다.

호랑이 담배... 머 그때 한번 사용해보고 이번에 새로운버전을 사용하려니
무척 복잡해 졌네요~

옛날에는 그냥 메인페이지를 내 맘대로 디자인하고 그냥 게시물만 끌어오면 됐는데
지금 옛날방식으로 게시물 끌어오면 인클루드 되는 파일이랑 이중으로 출력이 됩니다.
스킨을 인클루드해서 제가 디자인한것과 스킨이 짬뽕이 되어 버리네요~

메인페이지 간단하게 제맘대로 디자인해서 게시물 끌어오는곳에
<?=latest("",photo_01, 2, 34);?> 요 소스를 넣으면

해당 게시판의 게시물은 끌어오구요~ 그래서 앞에 테이블이름만 바꿔서 디자인하면 됐는데

지금은 저걸 넣고 나도 테이블 셀렉트 하는 인클루드 아래...

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

$g4['title'] = "";
include_once("./_head.php");
?>

-----------------------------------------------------------------------------------------------------------------------------------
이놈이 latest.lib.php 를 불러오고 그 놈을 또 열어보면 아래...

-----------------------------------------------------------------------------------------------------------------------------------

<?
if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
function latest($bo_table, $rows=10, $subject_len=40, $options="")
{
    global $g4;

    if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";

    $list = array();

    $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
    $board = sql_fetch($sql);

    $tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
    $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
    explain($sql);
    $result = sql_query($sql);
    for ($i=0; $row = sql_fetch_array($result); $i++)
        $list[$i] = get_list($row, $board, $subject_len);
   
    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}
?>
------------------------------------------------------------------------------------------------------------------------------

이렇게 복잡하게 또 스킨을 인클루드 하는 바람에 아주 복잡해 죽겠습니다.

서두가 길었네요~

암튼 저런 것들 다 없애고 그냥 index.php 에 <?=latest("",photo_01, 2, 34);?> 이 놈만 넣고

다른거에 방해 받지 않고 디자인 내맘대로 할 수 있게 하려면  어떻게 코딩해야하죠?

그냥 테이블 셀렉트 하는 방법만 알면 될것같은데...

고수님들 제발 알려주세요~ ㅜㅜ

부탁드려요~

댓글 전체

include_once("./_common.php");
include_once("./_head.php");
위 2개를 인클루드 하지 않으면 그누가 제대로 안돌아갈겁니다. 핵심적인 요소들이죠.

include_once("$g4[path]/lib/latest.lib.php");
저 파일은 최신글을 추출하는 코드로 인덱스에서는 필수로 인클루드 하여야 합니다.

디자인이라 하시면 깨끗한 상태에서 head.php와 tail.php을 버려버리고 index.php로만 꾸미겠다는 말씀이신가요?

그렇다면 index.php에서는 _head.php 와 _tail.php를 인클루드 합니다.
안을 살펴보면 별거 없죠. head.php 와 tail.php를 인클루드 하는 겁니다.
head.php와 tail.php이 뭐하는 파일인지는 아실테고.. 모르시다면 운영메뉴얼을 참고하세요.

또 요놈들 안에서는 head.sub.php와 tail.sub.php를 인클루드 합니다.
바로바로 요놈들이 중요한 놈들이죠.

즉, 디자인을 깨끗이 하시려면 index.php에서 _head.php와 _tail.php를 인클루드 하는 자리를 head.sub.php와 tail.sub.php로 교체해 주시면 텅빈 화면을 보실 수 있을겁니다. 물론 index.php에 있는 내용들은 출력을 해야겠지요.


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

index.php 내용....

include_once("./tail.sub.php");
답변 감사드립니다.

언뜻 이해가 잘 안되지만...

제가 질문드리는것은 head 나 tail 같은거 아무것도 인클루드 하지 않고

그냥 index 만으로 메인페이지를 만들려고 합니다.

그래서 $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";

이런식으로 다른 서브파일을 인클루두 하지 않고 위와같이 테이블 셀렉트 명령만 index 페이지에

함께 넣어서  원하는 게시물 뿌릴자리에 <?=latest("",photo_01, 2, 34);?> 이렇게 뿌려주려합니다.

말 그대로 2중 3중의 인클루드 파일 필요없이 걍 메인페이지에서 쿼리를 날려 원하는 최근게시물만

가져오려고 합니다.

대력 DB에 날릴 쿼리 -> $sql = " select * from $g4[board_table] where photo_01 = '$bo_table'";

메인페이지에서 바로 쿼리 날리고 게시물 바로 가져올 수 있게 <?=latest("",photo_01, 2, 34);?>

하려합니다.

제가 설명을 제대로 하는지 모르겠네요~

한번더 봐주시면 감사하겠습니다.
참고로 옛날 인덱스 페이지 소스입니다.

----------------------------------------------------------------------------------------------------------------------------------
<?
if (!defined("_GNUBOARD_")) exit;
define("_DOCTYPE_", "DESIGN");
$html_title = "";
?>
<script language="JavaScript" type="text/javascript">
<!--
function winopen(url, field)
{
    var opt = "toolbar=no,resizable=no,scrollbars=no,location=no,resize=no,menubar=no,directories=no,copyhistory=0,width=334,height=435,top= 1,left = 1";
    window.open(url, 'new_window1', opt);
}
//-->
</script>
<table width="406" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><img src="./img/main/img/board.jpg" width="406" height="40" border="0" usemap="#Map" /></td>
  </tr>
  <tr>
    <td height="105" background="./img/main/img/board_down.jpg" valign="top">
<table width="406" height="105" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="57" height="40"></td>
    <td width="238" valign="top">
<?=latest('basic',freeboard, 2, 34);?>
</td>
    <td width="111"></td>
  </tr>
  <tr>
    <td width="57" height="40"></td>
    <td width="238" valign="top">
<?=latest('gallery',gallery, 2, 34);?>
</td>
    <td width="111"></td>
  </tr>
  <tr>
    <td height="25">&nbsp;</td>
    <td><? if ($member[mb_level] >= 10 || $is_admin == "default" || $is_admin == "group") { echo "<a href='?doc=bbs/admin/index.php'>°&uuml;¸?&Agrave;&Uacute;</a>"; } ?></td>
    <td></td>                                                                                     
  </tr>
</table>
</td>
  </tr>
  <tr>
    <!--<td valign="top"><img src="./img/main/img/main2.jpg" width="406" height="556"></td>-->
<td valign="top" width="406" height="556" background="./img/main/img/bg.jpg"><table width="406" height="556" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="153"><a href="./?doc=bbs/admin/index.php"><font color="143666">.</font></a></td>
      </tr>
      <tr>
        <td height="403">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="406" height="403">
      <param name="movie" value="./img/main/img/effect09.swf" />
      <param name="quality" value="high" />
  <param name="wmode" value="transparent" />
      <embed src="file:./img/main/img/effect09.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="406" height="403"></embed>
    </object>
</td>
      </tr>
    </table></td>
  </tr>
</table>
<map name="Map" id="Map">
  <area shape="rect" coords="265,19,300,25" href="./gnuboard.php&bo_table=freeboard" />
</map>

---------------------------------------------------------------------------------------------------------------------------------------
아무것도 인클루드 하지 않으면 그누가 돌아가지를 않지요. ㅡ_ㅡa

<?=latest("",photo_01, 2, 34);?> 최신글을 추출하는 코드나.
$g4[board_table] 이런 그누 변수들도.

기본적으로 그누에서 지원하는 변수, 상수, 함수 등이 있어야 돌아갑니다.

index 내에서 쿼리를 써서 데이터 추출해서 최신글을 뽑아오는 것들을 다 하시려면 그에 필요한 변수, 함수, 상수 등등을 모두 index에다가 설정을 해주셔야 할겁니다.

옛날 인덱스는 봐도 모르겠군요.
상수 선언 하나 해주긴 했네요. define("_DOCTYPE_", "DESIGN");  .... 뭔지는 모르겠지만.

참고로 그누에서는 플래시를 불러들이려 작성한 <object ~~~ </object> 이 코드를 단 한줄로 압축 할 수 있는 함수도 지원한답니다. 최신글 코드 처럼 말이지요.
밀공님이 작성하신 부분은 그누3네요.
그누3에서는 define("_DOCTYPE_", "DESIGN"); 이 일종의 인클루드 방식을 지정하는 방법이었습니다.
인덱스에서 인클루드 및 디자인 방식이 지정되어 있어서..
위 헤드를 작성하면..
head.sub.php를 인클루드할지 head.php 까지 인클루드할지 지정해놓은 부분이라 간편했습니다.
그누4에서는 마냐님이 작성하신대로 인클루드해야지 사용이 가능합니다.

http://sir.co.kr/manual/youngcart4/?man=page.htm 에서 그누3의 방식과 비교해놓았네요. 읽어보세요~
그누 설치시 생성되는 index.php 파일을 참고해보셔도 되구요.
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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