페이지당 목록수 뽑는 것을 모르겠습니다. > 그누4 질문답변

그누4 질문답변

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

페이지당 목록수 뽑는 것을 모르겠습니다. 정보

페이지당 목록수 뽑는 것을 모르겠습니다.

본문

아래의 소스를 응용해서 메인의 베스트 글을 게시판처럼 넘겨가면서 보려고 합니다.
그런데 한 페이지당 목록수 제한하는 걸 모르겠네요.
맨 윗쪽에 있는 $cols  = $options; 로 가로에 들어갈 갯수는 구하는 건 알겠는데
세로는 무조건 총 게시물 수를 $cols로 나눈것으로 나와버려서 어디서 제한을 걸어줘야 되는지 모르겠습니다.
가로는 4개, 세로는 2개로 하고 나머지는 다음페이지로 넘기고 싶은데 어떻게 해야 할까요?


* 출처: 스킨 자료실 gallery_004_num

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

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가


$cols  = $options; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$image_h  = 12; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';

//관리자 설정 테이블 환경설정  ==>  $bo_table_cf;
?>
<style type="text/css">
<!--
.data  { font-family:돋움; font-size:8pt; color:#999999; }
-->
</style>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="17" height="17" background="<?=$latest_skin_path?>/img/table_top_left.gif"></td>
<td background="<?=$latest_skin_path?>/img/table_top.gif"></td>
<td width="17" height="17" background="<?=$latest_skin_path?>/img/table_top_right.gif"></td>
</tr>
<tr>
<td width="17" height="30" background="<?=$latest_skin_path?>/img/table_title_left.gif"></td>
<td background="<?=$latest_skin_path?>/img/table_title_bg.gif">

<!----상단 타이틀--->
<table width='100%' border='0' cellspacing='0' cellpadding='0' align='left'>
  <tr>
      <td width='226'>&nbsp;<strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a></td>
        <!--
      <td width='49'><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
      -->
  </tr>
  <tr><td colspan=2 height=5 ></td></tr>
  <tr><td colspan=2 height=1 bgcolor='#cccccc'></td></tr>
</table>
<!----상단 타이틀--->

</td>
<td width="17" background="<?=$latest_skin_path?>/img/table_title_right.gif"></td>
</tr>
<tr>
<td width="17" background="<?=$latest_skin_path?>/img/table_left.gif"></td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height='8'></td></tr>
<tr>
<td align='center'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>

<? for ($i=0; $i<count($list); $i++) {
  if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; }
?>

<td width="<?=$col_width?>%" align="center" valign='top'>

<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];

  if ( file_exists($thumb) )
$img = $thumb;
 
    $style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
    if ($list[$i][icon_new]) {
    $style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
  $subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
    $wr_hit  = $list[$i]['wr_hit'];
    $wr_id  = $list[$i]['wr_id'];
//    if ($list[$i]['comment_cnt']) //코
//        $cmt = "({$list[$i]['comment_cnt']})";

$bg = "";  //새글?
    if ($list[$i][icon_new])
        $bg="la_top_2.gif";
    else
        $bg="la_top_1.gif";

    echo $list[$i][icon_reply] . " ";

echo "<table width='116' cellpadding='0' cellspacing='0' border='0'>";
echo " <tr><td background='{$latest_skin_path}/img/la_bg.gif' valign='top' align='center'>
<a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">
<img src='{$img}' width='140' height='104' border=0' style='border:2 solid #B2BAEE'>
</a></td></tr>";
echo " <tr><td height='16' align='center'>{$subject}</td></tr>";
echo " <tr><td height='12' align='center' style='font-size:11px; color:#CCCCCC;'>조회수 : {$wr_hit}</td></tr>";
echo "</table>";
?>
</td>
<? } ?>
<?
$cnt = ($i%$cols);
for ($k=$cnt; $k<$cols && $cnt; $k++) {
    echo "<td width=$col_width%>&nbsp;</td>";
}
?>
  <? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?>
  <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
  </tr>
 
 
 
  <tr><td align="center" colspan="<?=$cols?>">
  <table align="center" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center">
<?
//////////////페이지///////////////

$pageviewsu=5; //한페이지에 보여질 목록수
$pagegroup=ceil(($pagenum+1)/$pageviewsu); //페이지 그룹결정
$pagestart=($pageviewsu*($pagegroup-1))+1; //시작페이지결정
$pageend=$pagestart+$pageviewsu-1; //종료페이지결정

$num_url = "index.php?gr_id=bill_skin";

if($pagegroup>1){
$prev=$pagestart-$pageviewsu-1;//이전목록그룹의 시작페이지결정
echo"[<a href=$num_url&pagenum=$prev>◀◀</a>] ";
}

if($pagenum){
$prevpage=$pagenum-1;
echo"[<a href=$num_url&pagenum=$prevpage>◀</a>] ";
}

for($i=$pagestart;$i<=$pageend;$i++)
{
if($pagesu<$i){break;}
$j=$i-1;
if($j==$pagenum){echo "$i ";}
else{echo "[<a href=$num_url&pagenum=$j>$i</a>] ";}
}

if(($pagenum+1)!=$pagesu){
$nextpage=$pagenum+1;
echo"[<a href=$num_url&pagenum=$nextpage>▶</a>] ";
}

if($pageend<$pagesu){echo"[<a href=$num_url&pagenum=$pageend>▶▶</a>] ";}

//////////////페이지///////////////

?>
 
      </td></tr></table> 
 
 
 
</table>
</td>
</tr>
</table>
</td>
<td width="17" background="<?=$latest_skin_path?>/img/table_right.gif"></td>
</tr>
<tr>
<td width="17" height="17" background="<?=$latest_skin_path?>/img/table_btm_left.gif"></td>
<td background="<?=$latest_skin_path?>/img/table_btm.gif"></td>
<td width="17" height="17" background="<?=$latest_skin_path?>/img/table_btm_right.gif"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10"></td>
</tr>

댓글 전체

전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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