o

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

최신글과 함게 전체 올립니다.
최신겔러리 추출에는 조금 에러부분이 있는듯합니다.
소스를 참고로 기죤소스보고 수정하시면되겠죠 *^^*
아참 날짜 옆에 넣는게 빠졌네요 *^^* 추가하는것 힘들지 않으시겠죠 *^^*

########################################################################################
##   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_"; // 게시판 테이블의 접두사
   
   $게시판제목   = $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";

}



// 최신 그림추출
function newpic($skins, $bo_table, $subject, $rows, $subjectlen='')
{
   global $cfg;

   $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_"; // 게시판 테이블의 접두사
   
   $게시판제목   = $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];        
// 갤러리
       $temp[$i]->images = $row[wr_file1];
       $temp[$i]->tr = false;
       if ($i > 0 && ($i % 5 == 0))
           $temp[$i]->tr = true;
           $temp[$i]->dir_file = $cfg[dir_file];

       }
       mysql_free_result($result);

   require_once "./gnu2/skin/$skins/newpic.skin.php";
   }
   
?>


########################################################################################
##   gnu2/skin/login_skin/newpic.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" align=right >
           <? 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>
</table>
  <!-- 최근글 목록이 나오는 부분 -->
<table width=100% border=0 cellpadding=4 cellspacing=1 style='table-layout:fixed;'>

   <tr>

   <? for ($i=0; $i<count($temp); $i++) { ?>  

<? if ($temp[$i]->tr) echo "</tr><tr>" ?>
       <td width=20% valign=top>
           <table width=100%>
               <tr>
                   <td align=center>
                       <? if ($temp[$i]->images) { ?>
                           <a href='<? echo $절대경로 ?>/gbview.php?bo_table=<? echo $게시판 ?>&wr_id=<? echo $temp[$i]->wr_id ?>'>
                           <img src='<? echo $절대경로 ?>/data/file/<? echo $temp[$i]->images ?>'width=70 height=70 border=0></a>
                       <? } ?>  
                             
                   </td>
               </tr>
               <tr>
                   <td style='font-size:9pt;' align=center><? echo $제목 ?></td>
               </tr>
           </table>
       </td>
   <? } ?>
   </tr>
</table>
|

댓글 3개

감사합니다.
최신글 추출이 한 스킨당 하나씩 먹는거 같습니다. 최신글 추출한 만큼 스킨을 만들어야 된다는...^^;
최신글 추출에서 여러개를할경우 현재 배열함수 문제인지 한개만 나와버리는 버그가있습니다. 그 버그 잡기쩐까지는 이 소스로 사용하세요 *^^*
<?

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

$sql = " select * from gb_board where bo_table = '$bo_table' ";
$bd = sql_fetch_array($sql);

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


$cfg[board_table_prefix] = "gb_write_"; // 게시판 테이블의 접두사

$게시판제목 = $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);

echo "
<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:돋움'>
<img src='$새글스킨경로/$스킨/images/qaz_lost_02.gif' width='22' height='29' border='0'></td>
<td height=22 width=343 background='$새글스킨경로/$스킨/images/qaz_lost_04.gif' >
<b>$게시판제목</b></td>
<td height=22 background='$새글스킨경로/$스킨/images/qaz_lost_04.gif' >
<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>
<img src='$새글스킨경로/$스킨/images/qaz_lost_03.gif' width='22' height='29' border='0'></td>
</tr>
</table>


<tr>
<td height=2 colspan=4></td>
</tr>
<tr>
<td height=20 colspan=4 >
<table border='0' cellpadding='0' cellspacing='0' width='100%'> ";
for ($i=0; $i<count($temp); $i++) {
echo "
<tr>
<td style='font-size:9pt;'> <img src='$새글스킨경로/$스킨/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>";


echo "<a href='$절대경로/gbview.php?bo_table=$게시판&wr_id={$temp[$i]->wr_id}'>{$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>";

echo " </td>
</tr> ";
}
echo " </table>

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



}
댓글을 작성하시려면 로그인이 필요합니다.
+
제목 글쓴이 날짜 조회
03-03-28 조회 2,511
03-03-26 조회 3,312
03-03-26 조회 2,711
03-03-14 조회 3,090
03-03-13 조회 6,954
03-03-13 조회 3,063
03-03-13 조회 2,615
03-03-11 조회 3,084
03-03-11 조회 4,358
03-03-09 조회 2,922
03-03-07 조회 3,403
03-03-06 조회 2,817
03-03-03 조회 3,764
03-03-01 조회 3,566
03-02-24 조회 3,052
03-02-24 조회 3,673
03-02-24 조회 3,060
03-02-19 조회 4,928
03-02-16 조회 2,998
03-02-07 조회 3,212