나라오름님 다시한번 문의합니다. 정보
그누보드 나라오름님 다시한번 문의합니다.본문
페이징을하려구하는데 우선 갯수가 $rows = 10; 지정했는데 전체가 다나오고
페이징숫자가 맞지않습니다. 좀 봐주시겠습니까?
<?
$image = array();
$d = dir("./data/file/$bo_table");
while (false !== ($entry = $d->read())) {
if(eregi(".jpg|.gif",$entry)) {
$imagefile = "./data/file/$bo_table/$entry";
$size += filesize($imagefile);
$idx = filectime($imagefile);
// 배열 첨자
$image["$idx$entry"] = $entry;
}
}
$d->close();
$rows = 10; <------------------------------------10개씩 나누어야하는데 안됩니다.
$total_count = count($image);
$total_page = ceil($total_count / $rows);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $rows;
?>
<table width=100%><tr>
<?
if (count($image)) {
krsort($image);
$i=0;
$isize = 120;
foreach($image as $key=>$value) {
if ($i && $i%$board[bo_gallery_width]==0) {
echo "</tr><tr><td colspan=4 height=1 background='$board_skin/skin_img/dot.gif'></td><tr>";
}
$imagefile = "./data/file/$bo_table/$image[$key]";
$imagesize = @getimagesize($imagefile);
if (($width = $imagesize[0]) > $isize) { $width = $isize; }
if (($height = $imagesize[1]) > $isize) { $height = $isize; }
echo "<img src='$imagefile' width=$width height=$height><br>";
{
$i++;
}
}
?></tr>
</table>
<!-- 페이지 링크 시작 -->
<table width='100%'>
<tr>
<td align=center>
<?= get_paging($default[de_write_pages], $page, $total_page, "./?doc=$board_skin/image.php&bo_table=$bo_table&$qstr&page=");?>
</td>
</tr>
</table>
<!-- 페이지 링크 끝 -->
페이징숫자가 맞지않습니다. 좀 봐주시겠습니까?
<?
$image = array();
$d = dir("./data/file/$bo_table");
while (false !== ($entry = $d->read())) {
if(eregi(".jpg|.gif",$entry)) {
$imagefile = "./data/file/$bo_table/$entry";
$size += filesize($imagefile);
$idx = filectime($imagefile);
// 배열 첨자
$image["$idx$entry"] = $entry;
}
}
$d->close();
$rows = 10; <------------------------------------10개씩 나누어야하는데 안됩니다.
$total_count = count($image);
$total_page = ceil($total_count / $rows);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $rows;
?>
<table width=100%><tr>
<?
if (count($image)) {
krsort($image);
$i=0;
$isize = 120;
foreach($image as $key=>$value) {
if ($i && $i%$board[bo_gallery_width]==0) {
echo "</tr><tr><td colspan=4 height=1 background='$board_skin/skin_img/dot.gif'></td><tr>";
}
$imagefile = "./data/file/$bo_table/$image[$key]";
$imagesize = @getimagesize($imagefile);
if (($width = $imagesize[0]) > $isize) { $width = $isize; }
if (($height = $imagesize[1]) > $isize) { $height = $isize; }
echo "<img src='$imagefile' width=$width height=$height><br>";
{
$i++;
}
}
?></tr>
</table>
<!-- 페이지 링크 시작 -->
<table width='100%'>
<tr>
<td align=center>
<?= get_paging($default[de_write_pages], $page, $total_page, "./?doc=$board_skin/image.php&bo_table=$bo_table&$qstr&page=");?>
</td>
</tr>
</table>
<!-- 페이지 링크 끝 -->
댓글 전체
나라오름님
이 질문의 앞전에 토탈카운트구하는질문을 우연찮게 메일로날아온..... 지워진 코멘트를 봤습니다.
너그러이 생각하시기 바랍니다.
먼저 질문의 요지를 말하고싶어도 어떻게 질문을 올려야될지 모르는게 초보의 한계입니다.
이렇게 하고는싶은데 문의하는 제목을 몰라서 하는경우도 많았구요.......
그누에 올려진 질문을 보고 이해할수있는부분에서 이렇게 저렇게 질문을 드렸습니다.
아뭏든 많은 양해 바랍니다.
이 질문의 앞전에 토탈카운트구하는질문을 우연찮게 메일로날아온..... 지워진 코멘트를 봤습니다.
너그러이 생각하시기 바랍니다.
먼저 질문의 요지를 말하고싶어도 어떻게 질문을 올려야될지 모르는게 초보의 한계입니다.
이렇게 하고는싶은데 문의하는 제목을 몰라서 하는경우도 많았구요.......
그누에 올려진 질문을 보고 이해할수있는부분에서 이렇게 저렇게 질문을 드렸습니다.
아뭏든 많은 양해 바랍니다.
나라오름님 감사합니다. 덕분에 해결을 봤습니다.^^
배열을 역순으로 하는걸 수순으로 바꿀수 있나요?
아직 문제가 조금은 남아있어 귀찮겠지만 질문을 마져올립니다.
감사합니다.
배열을 역순으로 하는걸 수순으로 바꿀수 있나요?
아직 문제가 조금은 남아있어 귀찮겠지만 질문을 마져올립니다.
감사합니다.
<?
$image = array();
$d = dir("./data/file/$bo_table");
// 디렉토리내의 이미지 파일을 배열로 저장
while (false !== ($entry = $d->read())) {
if(eregi(".jpg|.gif",$entry)) {
$imagefile = "./data/file/$bo_table/$entry";
$image[] = $entry;
}
}
$d->close();
// 한 페이지에 표시될 이미지 갯수
$rows = 10;
// 총 이미지 수
$total_count = count($image);
// 총 페이지 수
$total_page = ceil($total_count / $rows);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $rows;
?>
<table><tr>
<?
// 배열을 역순으로 정열
if (count($image)) { krsort($image); }
$isize = 120;
// 이미지 출력
for ($i=$from_record; $i<$from_record+$rows; $i++) {
if ($i && $i%$board[bo_gallery_width]==0) {
echo "</tr><tr><td colspan=4 height=1 background='$board_skin/skin_img/dot.gif'></td><tr>";
}
$imagefile = "./data/file/$bo_table/$image[$i]";
$imagesize = @getimagesize($imagefile);
if (($width = $imagesize[0]) > $isize) { $width = $isize; }
if (($height = $imagesize[1]) > $isize) { $height = $isize; }
echo "<img src='$imagefile' width=$width height=$height><br>";
}
?>
</tr>
</table>
<!-- 페이지 링크 시작 -->
<table>
<tr>
<td align=center>
<?= get_paging($default[de_write_pages], $page, $total_page, "./?doc=$board_skin/file.php&bo_table=$bo_table&$qstr&page=");?>
</td>
</tr>
</table>
$image = array();
$d = dir("./data/file/$bo_table");
// 디렉토리내의 이미지 파일을 배열로 저장
while (false !== ($entry = $d->read())) {
if(eregi(".jpg|.gif",$entry)) {
$imagefile = "./data/file/$bo_table/$entry";
$image[] = $entry;
}
}
$d->close();
// 한 페이지에 표시될 이미지 갯수
$rows = 10;
// 총 이미지 수
$total_count = count($image);
// 총 페이지 수
$total_page = ceil($total_count / $rows);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $rows;
?>
<table><tr>
<?
// 배열을 역순으로 정열
if (count($image)) { krsort($image); }
$isize = 120;
// 이미지 출력
for ($i=$from_record; $i<$from_record+$rows; $i++) {
if ($i && $i%$board[bo_gallery_width]==0) {
echo "</tr><tr><td colspan=4 height=1 background='$board_skin/skin_img/dot.gif'></td><tr>";
}
$imagefile = "./data/file/$bo_table/$image[$i]";
$imagesize = @getimagesize($imagefile);
if (($width = $imagesize[0]) > $isize) { $width = $isize; }
if (($height = $imagesize[1]) > $isize) { $height = $isize; }
echo "<img src='$imagefile' width=$width height=$height><br>";
}
?>
</tr>
</table>
<!-- 페이지 링크 시작 -->
<table>
<tr>
<td align=center>
<?= get_paging($default[de_write_pages], $page, $total_page, "./?doc=$board_skin/file.php&bo_table=$bo_table&$qstr&page=");?>
</td>
</tr>
</table>