2.10정식용 최신글 추츨(버그패치완료) > 그누3 팁자료실

그누3 팁자료실

2.10정식용 최신글 추츨(버그패치완료) 정보

일반 2.10정식용 최신글 추츨(버그패치완료)

첨부파일

login_skin_cccver1.zip (32.6K) 19회 다운로드 2004-02-18 22:21:38

본문

먼저....기존 최신글, 최신그림 추출소스상에 스킨을 이용하면 한개만 출력되는 버그때문에
스킨을 이용할수가 없었는데 배열에 문제가 있나 싶어서 소스를 한줄씩 다 분석해 본 결과
require_once 문에 문제가 있었습니다. 첫번째 게시판은 불러와지는데 2번째부터는 화면에 출력이 되지 않는 현상이 발생했는데...잘은 모르지만 require_once함수 특성상 한번만 불러와지게 되어있어서
같은 화면에 두개가 존재하지 못하기때문에 발생한듯합니다. 그래서 include로 대처해보니
이상없이 나오는군요.... 이거를 바탕으로 최신게시물, 최신그림 추츨 스킨을 제작하시기 바랍니다.
간단하게 최신글 추츨 소스입니다.

최신글 및 최신그림추츨은 userlib.inc.php라는 파일을 만들어서 사용시 require_once하여 사용한다는 전제하에 만들었습니다.

/#####################################################################################
/#      userlib.inc.php
/#####################################################################################

<?

// 최신글 추출
function newlist($skins, $bo_table, $subject, $rows, $subjectlen='')
{
 &nbsp; global $cfg;

 &nbsp; $sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
 &nbsp; $bd = sql_fetch_array($sql);

 &nbsp; if ($subjectlen == '') $subjectlen = $bd[bo_subject_len];

 &nbsp;
 &nbsp; $cfg[board_table_prefix] = "gb_write_"; // 게시판 테이블의 접두사
 &nbsp;
 &nbsp; $cfg[url] &nbsp; &nbsp; = "http://111.111.111.111/~oldccc/gnu2"; &nbsp; &nbsp;// 개인설정에 맞게수정하세요

 &nbsp; $skindir &nbsp; &nbsp; &nbsp;= "$cfg[url]/skin/$skins";
 &nbsp; $skinimg &nbsp; &nbsp; &nbsp;= "$skindir/images"; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// 이미지파일을 images폴더에 넣는걸 기본으로했습니다.

 &nbsp; include "./gnu2/skin/$skins/newlist_head.skin.php"; &nbsp; &nbsp; // Head 출력부분입니다. 글만 출력시는 주석처리하시면됩니다.

 &nbsp; $table = "{$cfg[board_table_prefix]}{$bo_table}";
 &nbsp; $result = sql_query_error(" select * from $table where wr_comment = 0 order by wr_id desc limit {$rows} ");
 &nbsp; for ($i = 0; $row = mysql_fetch_array($result); $i++) {

&nbsp; $icon_file = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_file1] || $row[wr_file2])
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_file = "<img src='$skinimg/icon_file.gif' align=absmiddle>";

 &nbsp; &nbsp; &nbsp; $icon_link = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_link1] || $row[wr_link2])
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_link = "<img src='$skinimg/icon_link.gif' align=absmiddle>";

 &nbsp; &nbsp; &nbsp; $a_list_link = "<a href='$cfg[url]/gbview.php?$qstr&page=$page&wr_id=$data[wr_id]' class=s_a>";

 &nbsp; &nbsp; &nbsp; $icon_new = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bd[bo_new] * 3600))
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_new = "<img src='$skinimg/icon_new.gif' align=absmiddle'>";

 &nbsp; &nbsp; &nbsp; $icon_hot = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_hit] >= $bd[bo_hot])
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_hot = "<img src='$skinimg/icon_hot.gif' align=absmiddle'>";

 &nbsp; &nbsp; &nbsp; $icon_battle = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_commentcnt] >= $bd[bo_battle])
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_battle = "<img src='$skinimg/icon_battle.gif' align=absmiddle'>";
 &nbsp; &nbsp; &nbsp; $icon_secret = "";
 &nbsp; &nbsp; &nbsp; if ($row[wr_secret])
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $icon_secret = "<img src='$skinimg/icon_secret.gif' align=absmiddle'>"; &nbsp;

&nbsp;
&nbsp; $wr_commentcnt &nbsp;= ($row[wr_commentcnt]) ? $row[wr_commentcnt] : null;
 &nbsp; &nbsp; &nbsp; $wr_subject &nbsp; &nbsp; = get_text(cut_str($row[wr_subject], $subjectlen, '…'));
 &nbsp; &nbsp; $wr_content &nbsp; &nbsp; = get_text(cut_str($row[wr_content], 400, '....[계속]')); &nbsp;// 내용 미리보기를 위해 넣었습니다. 400자까지만 짜르기했습니다.
 &nbsp; &nbsp; &nbsp; $wr_id &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= $row[wr_id]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 게시판번호
&nbsp; $wr_name &nbsp; &nbsp; &nbsp; &nbsp;= $row[wr_name]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 게시자이름 혹 최신글에 이름출력을 위해 변수선언했습니다.
 &nbsp; &nbsp; &nbsp; $wr_datetime &nbsp; &nbsp;= $row[wr_datetime]; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 최신글에 날짜까지 출력하고싶을때를 위해 변수선언했습니다.
&nbsp;
&nbsp; include "./gnu2/skin/$skins/newlist_main.skin.php";
 &nbsp; }
 &nbsp; mysql_free_result($result);

}


?>
/#####################################################################################
/# &nbsp; &nbsp; &nbsp;./gnu2/skin/$skins/newlist_head.skin.php
/#####################################################################################
<!-- 최신글 추출 head 부분 -->
<table border=0 cellpadding=0 cellspacing=0 width=100% align=center height=20 style='font-family:Verdana; font-size:9pt;'>
 &nbsp; &nbsp;<tr>
 &nbsp; &nbsp; &nbsp; &nbsp;<td width=22 height=22 style='font-size:9pt; font:돋움'>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<?="<img src='$skinimg/qaz_lost_02.gif' width=22 height=29 border=0>" ?></td> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; &nbsp; &nbsp;<td height=22 width=343 background='<?=$skinimg?>/qaz_lost_04.gif' >
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<?="<b>$subject</b>"?></td>
 &nbsp; &nbsp; &nbsp; &nbsp;<td height=22 background='<?=$skinimg?>/qaz_lost_04.gif' >
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<?="<a href='$cfg[url]/gblist.php?bo_table=$bo_table'>
<img src='$skinimg/more.gif' width=40 height=15 border=0></a>" ?></td>
 &nbsp; &nbsp; &nbsp; &nbsp;<td width=22 height=22 align=right>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<?="<img src='$skinimg/qaz_lost_03.gif' width=22 height=29 border=0>" ?></td>
 &nbsp; &nbsp;</tr>
</table>
/#####################################################################################
/# &nbsp; &nbsp; &nbsp;./gnu2/skin/$skins/newlist_main.skin.php
/#####################################################################################
<?
/*
최신글추출 스킨 사용가능 변수 ver 2.10정식용

<?=$skindir?> &nbsp; &nbsp; &nbsp; &nbsp; 스킨디렉토리 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;gnu2/skin/스킨디렉토리명 까지
<?=$skinimg?> &nbsp; &nbsp; &nbsp; &nbsp; 스킨디렉토리이미지 &nbsp; &nbsp;gnu2/skin/스킨디렉토리명/images 까지
<?=$cfg[url]?> &nbsp; &nbsp; &nbsp; &nbsp;절대주소 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://xxx.xxx.xxx.xxx/
<?=$bo_table?> &nbsp; &nbsp; &nbsp; &nbsp;게시판명
<?=$wr_commentcnt?> &nbsp; 커맨트갯수 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_commentcnt]
<?=$wr_subject?> &nbsp; &nbsp; &nbsp;제목 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_subject]
<?=$wr_content?> &nbsp; &nbsp; &nbsp;내용 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_content]
<?=$wr_id?> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 글번호 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_id]
<?=$wr_name?> &nbsp; &nbsp; &nbsp; &nbsp; 작성자이름 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_name]
<?=$wr_datetime?> &nbsp; &nbsp; 작성시간 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;원본 $row[wr_datetime]


기본적으로 최신게시판에 사용되는 변수는 다 선언했습니다.
기타 변수 추가는 userlib.inc.php에서 변수면 = $row[wr_변수명];
하고 선언해주면됩니다.


*/
?>
 &nbsp;
 &nbsp; <!-- 최근글 목록이 나오는 부분 -->
<table border=0 cellpadding=0 cellspacing=0 width=100% align=center>
<tr>
<td width=100% onMouseOver=this.style.backgroundColor='FFFAF3' onMouseOut=this.style.backgroundColor='' style='font-size:9pt;' title='<?=$wr_content?>'>
<img src='<?=$skinimg?>/arrow.gif' border=0>&nbsp;
<a href='<?=$cfg[url]?>/gbview.php?bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>'><?=$wr_subject?></a>
<span style='font-size:8pt;'><?=$commentcnt?></span>
<?=$icon_new?> <?=$icon_hot?> <?=$icon_battle?> <?=$icon_secret?>
</td>
</tr>
</table>

p.s : 최신겔러리 추출도 곧 정리해서 올리도록하겠습니다.
이것 버그 잡는다고 몇일고생을 했네요 *^^* 휴~~~~~~!
이걸 참조하셔서 좋은스킨 많이 만들어주세요 *^^*
추천
10
  • 복사

댓글 전체

<?
$reldir="http://www...........com";
require_once "$reldir/lib.inc.php";
require_once "$reldir/userlib.inc.php";
?>
<table width=100%><tr>
<td valign=top><? newlist("photo_list","album", "포토게시판", 5, 25); ?> </td>
</tr>
</table>
위의 내용으로 테스트를 했어여*^^*
© SIRSOFT
현재 페이지 제일 처음으로