o

gnu2.0 베타용 최신글 추출 (스킨방식)

· 2003-03-13 (목) 22:54:10 · 3060 · 1
lib.inc.php안에 집어 넣어도 되고
userlib.inc.php라는 파일로 따로 만들어서 해도됩니다.(운영자님이 넣치 않는관계로 저는
userlib.inc.php라는 파일로 만들어서 작성했습니다.

#############################################################################
##                                          userlib.inc.php                                               ##
<?

// 새글 추출
function newlist($skins, $bo_table, $subject, $rows, $subjectlen='')
{
   global $cfg, $absdir, $reldir, $uc1, $uc2, $uc3;

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

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

 
   $cfg[board_table_prefix] = "gb_write_"; // 사실 이건 config.inc.php부분입니다.
                                                          // 따로 불러왔기때문에 변수값이 넘어오지 않았습니다.
                                                         // 그래서 따로설정했습니다.
   $게시판제목 = $subject;        
   $게시판       = $bo_table;
   $절대경로     = $cfg[url];
   $새글스킨경로 = "$cfg[url]/$cfg[dir_skin]/";
   $스킨         = $skins;
   
       
   $table = "{$cfg[board_table_prefix]}{$bo_table}";
   $result = sql_query_error(" select * from $table where wr_comment = 0 order by wr_id desc limit {$rows} ");
   for ($i = 0; $row = mysql_fetch_array($result); $i++) {

           
       $temp[$i]->icon_file   = ($row[wr_file1] || $row[wr_file2]) ? true : false;
       $temp[$i]->icon_link   = ($row[wr_link1] || $row[wr_link2]) ? true : false;
       $temp[$i]->icon_new    = ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - ($board[bo_new] * 3600))) ? true : false;
       $temp[$i]->icon_hot    = ($row[wr_hit] >= $board[bo_hot]) ? true : false;
       $temp[$i]->icon_battle = ($row[wr_commentcnt] >= $board[bo_battle]) ? true : false;
       $temp[$i]->icon_secret = $row[wr_secret] ? true : false;            
           

       $temp[$i]->wr_commentcnt  = ($row[wr_commentcnt]) ? $row[wr_commentcnt] : null;

       $temp[$i]->wr_subject  = get_text(cut_str($row[wr_subject], $subjectlen, '…'));
       $temp[$i]->wr_id       = $row[wr_id];
       $temp[$i]->bo_table    = $bo_table;
       $temp[$i]->wr_datetime = $row[wr_datetime];
   }
   mysql_free_result($result);

   require_once "./gnu2/skin/$skins/newlist.skin.php";

}
?>

#############################################################################
##         gnu2/skin/login_skin/newlist.skin.php                                              ##
#############################################################################
<table border="0" cellpadding="0" cellspacing="0" width="100%" align=center height="20" style='font-family:Verdana; font-size:9pt;'>
   <tr>
       <td width="22" height="22" style="font-size:9pt; font:"돋움">
           <? echo "<img src='$새글스킨경로/$스킨/images/qaz_lost_02.gif' width='22' height='29' border='0'>" ?></td>                      
       <td height="22" width="343" background="<? echo "$새글스킨경로/$스킨" ?>/images/qaz_lost_04.gif" >
           <? echo "<b>$게시판제목</b>" ?></td>
       <td height="22" background="<? echo "$새글스킨경로/$스킨" ?>/images/qaz_lost_04.gif" >
           <? echo "<a href='$절대경로/gblist.php?bo_table=$게시판'>
           <img src='$새글스킨경로/$스킨/images/more.gif' width='40' height='15' border='0'></a>" ?></td>
       <td width="22" height="22" align="right">
           <? echo "<img src='$새글스킨경로/$스킨/images/qaz_lost_03.gif' width='22' height='29' border='0'>" ?></td>
   </tr>
 
  <!-- 최근글 목록이 나오는 부분 -->

   <tr>
       <td height=2 colspan=4></td>
   </tr>
   <tr>
        <td height=20 onMouseOver=this.style.backgroundColor='FFFAF3' onMouseOut=this.style.backgroundColor='' colspan=4>
           <table border='0' cellpadding='0' cellspacing='0' width='100%'>
   <? for ($i=0; $i<count($temp); $i++) { ?>            
               <tr>
                   <td style="font-size:9pt;"> <img src="<? echo "$새글스킨경로/$스킨" ?>/images/arrow.gif" border=0> 

                   <? if ($temp[$i]->icon_file) echo "<img src='$새글스킨경로/$스킨/images/icon_file.gif' align=absmiddle>" ?>
                   <? if ($temp[$i]->icon_link) echo "<img src='$새글스킨경로/$스킨/images/icon_link.gif' align=absmiddle>" ?>


                   <a href='<? echo $절대경로 ?>/gbview.php?bo_table=<? echo $게시판 ?>&wr_id=<? echo $temp[$i]->wr_id ?>'><? echo $temp[$i]->wr_subject ?></a>


                   <? if ($temp[$i]->wr_commentcnt) echo "$temp[$i]->wr_commentcnt" ?>
                   
                   <? if ($temp[$i]->icon_new) echo "<img src='$새글스킨경로/$스킨/images/icon_new.gif' align=absmiddle>" ?>
                   <? if ($temp[$i]->icon_hot) echo "<img src='$새글스킨경로/$스킨/images/icon_hot.gif' align=absmiddle>" ?>
                   <? if ($temp[$i]->icon_battle) echo "<img src='$새글스킨경로/$스킨/images/icon_battle.gif' align=absmiddle>" ?>                    
                   <? if ($temp[$i]->icon_secret) echo "<img src='$새글스킨경로/$스킨/images/icon_secret.gif' align=absmiddle>" ?>

                   </td>
               </tr>
   <? } ?>                
           </table>

        </td>
   </tr>
   <tr>
       <td width=100% height=1 background='<? echo $새글스킨경로 ?>/images/underline.gif' colspan=4></td>
   </tr>
</table>

사용방법은 같습니다. *^^*
대신 사용하실려면
require_once "./lib.inc.php";
require_once "./userlib.inc.php"; 이렇게 두개를 다 읽어 들어야겠죠 *^^*
기본은 박갑성님의 스킨를 기본으로 하였습니다.
아직 에러가 조금있으리라고 생각됩니다. 대충보시면 수정이 가능하리라고 믿고
newpic부분은 충분히 변경가능하시리라 믿습니다.
사실 아직 수정못한상태네요 *^^*

샘플사이트는 링크 #!

첨부파일

newlist.zip (2.2 KB) 12회 2004-02-18 22:21
|

댓글 1개

2005-05-07 (토) 23:44:54
감사합니다.
댓글을 작성하시려면 로그인이 필요합니다.

그누3 팁자료실

1,026건
+
제목 글쓴이 날짜 조회
03-03-28 조회 2,508
03-03-26 조회 3,309
03-03-26 조회 2,710
03-03-14 조회 3,087
03-03-13 조회 6,952
03-03-13 조회 3,061
03-03-13 조회 2,610
03-03-11 조회 3,082
03-03-11 조회 4,354
03-03-09 조회 2,920
03-03-07 조회 3,401
03-03-06 조회 2,815
03-03-03 조회 3,761
03-03-01 조회 3,565
03-02-24 조회 3,048
03-02-24 조회 3,671
03-02-24 조회 3,058
03-02-19 조회 4,926
03-02-16 조회 2,995
03-02-07 조회 3,212