미채택 완료

최신글 페이징 추가좀 도와주세요~

2014-03-01 (토) 03:24:06 6,663
안녕하세요 최신글에 페이징 기능을 넣으려구 하는데 소스 도움좀 부탁드릴게요~
 
 
Copy
<? if (!defined('_GNUBOARD_')) exit; 
// 최신글 추출 function latest_gallery($skin_dir="", $bo_table, $rows=10, $subject_len=40, $brch="") {     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); 
if ($brch == "sp")            $brch = "wr_31"; // 스페션순으로 쿼리 
elseif ($brch == "pe")          $brch ="wr_32"; // 프리미엄순으로 쿼리 
elseif ($brch == "be")          $brch ="wr_33"; // 베스트순으로 쿼리 
else                         $brch = "wr_id"; // 일반 최근순으로 쿼리 
$sql = " select * from $tmp_write_table where $brch='y'  order by wr_id desc limit 0, $rows "; 
 
    $result = sql_query($sql);     for ($i=0; $row = sql_fetch_array($result); $i++)         $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);         ob_start();     include "$latest_skin_path/latest.skin.php";     $content = ob_get_contents();     ob_end_clean(); 
    return $content; } ?>
 
위는 최신글 출력하는 lib파일입니다.
 
Copy
<?if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가$mod = 5;$img_width = 230;$img_height = 150;$img_quality = 100;
if (!function_exists("imagecopyresampled")) alert("GD 2.0.1 이상 버전이 설치되어 있어야 사용할 수 있는 갤러리 게시판 입니다.");
$data_path = $g4[path]."/data/file/$bo_table";$thumb_path = $data_path.'/thumb';
@mkdir($thumb_path, 0707);@chmod($thumb_path, 0707);
?><table width="100%" cellpadding="0" cellspacing="0"><tr><? for ($i=0; $i<count($list); $i++) {
 $img = "<img src='$board_skin_path/img/noimage.gif' border=0 title='이미지 없음'>";   $thumb = $thumb_path.'/'.$list[$i][wr_id];   // 썸네일 이미지가 존재하지 않는다면   if (!file_exists($thumb)) {    $file = $list[$i][file][0][path] .'/'. $list[$i][file][0][file];    // 업로드된 파일이 이미지라면    if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file) && file_exists($file)) {     $size = getimagesize($file);     if ($size[2] == 1)      $src = imagecreatefromgif($file);     else if ($size[2] == 2)      $src = imagecreatefromjpeg($file);     else if ($size[2] == 3)      $src = imagecreatefrompng($file);     else      break;
     $rate = $img_width / $size[0];     $height = (int)($size[1] * $rate);
     // 계산된 썸네일 이미지의 높이가 설정된 이미지의 높이보다 작다면     if ($height < $img_height)      // 계산된 이미지 높이로 복사본 이미지 생성      $dst = imagecreatetruecolor($img_width, $height);     else      // 설정된 이미지 높이로 복사본 이미지 생성      $dst = imagecreatetruecolor($img_width, $img_height);     imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_width, $height, $size[0], $size[1]);     imagejpeg($dst, $thumb_path.'/'.$list[$i][wr_id], $img_quality);     chmod($thumb_path.'/'.$list[$i][wr_id], 0606);    }   }
   if (file_exists($thumb))    $img = "<img src='$thumb' width=230 height=150>";    else    if(preg_match("/\.(swf|wma|asf)$/i","$file") && file_exists($file))      { $img = "<script>doc_write(flash_movie('$file', 'flash$i', '$img_width', '$img_height', 'transparent'));</script>";}?>
<?if ($i>0 && $i%$mod==0) { echo "</tr><tr>"; }?><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">  <tr>    <td height="90" align="center" valign="middle">  <table cellpadding="2" cellspacing="1" bgcolor="e4e4e4">      <tr>  <td align="center" onMouseOver=this.style.backgroundColor='#ff6600' onMouseOut=this.style.backgroundColor=''><a href='<?=$list[$i][href]?>')>  <?   echo "<a href='{$list[$i][href]}'>";  echo $img;  echo "</a>";  ?></a></td>        </tr>    </table></td>  </tr>  <tr>    <td height="45" align="center" valign="top">   <table width="200" border="0" cellpadding="0" cellspacing="2" >    <tr><td align="center" class="listsmall"><b><?=$list[$i][wr_1]?> <?=$list[$i][wr_2]?> <?=$list[$i][wr_3]?></b></td></tr>    <tr><td align="center" class="listsmall"><?=$list[$i][wr_11]?>년 <?=$list[$i][wr_12]?>월식</td></tr>    <tr><td align="center" class="listsmall"><font color=ff0000><b><?=number_format($list[$i][wr_5])?></b></font>만원<br><? if ($is_checkbox) { ?><input type=checkbox name=chk_wr_id[] value="<?=$list[$i][wr_id]?>"><? } ?></td></tr>  </table>
</td>  </tr></table></td><? } ?><?$nam = ($i%$mod);for ($k=$nam; $k<$mod && $nam; $k++){ echo "<td>&nbsp;</td>";}?><? if (count($list) == 0) { echo "<td colspan=$mod class=bbs>내용이 없습니다.</td>"; } ?></tr></table>
이것은 최신글을 출력하는 부분입니다.
초보자라 부탁드립니다 (_ _)
 
|

답변 1개

스킨게시판에 최신글 페이징되는 스킨들이 있어요.......

답변을 작성하려면 로그인이 필요합니다.