$total_count 을 어떻게 구할수있을까요? > 그누3질답

그누3질답

$total_count 을 어떻게 구할수있을까요? 정보

그누보드 $total_count 을 어떻게 구할수있을까요?

본문

한폴드안에서 전체이미지를 구할때 $total_count 을 어떻게 구할수있을까요?
페이지를 나누고싶어서 입니다.
<?
$d = dir("./data/file/$bo_table/");
while ($entry = $d->read()) {
    if(eregi(".jpg|.gif",$entry)) {
        $imagefile = "./data/file/$bo_table/$entry";
        $size += filesize($imagefile);
        $idx = filectime($imagefile);
        // 배열 첨자
        $image["$idx$entry"] = $entry;
    }
}

?>



<?

if (count($image)) {
    krsort($image);

$total_count = $key;
$rows=10;
$total_page  = ceil($total_count / $rows);
// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;
// 시작 레코드 구함
$from_record = ($page - 1) * $rows;
?>
  • 복사

댓글 전체

혹시 이런걸 원하나요...

<?

$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;
$total_count = count($image);

if ($total_count > 0) { krsort($image); }

$total_page  = ceil($total_count / $rows);

// 페이지가 없으면 첫 페이지 (1 페이지)
if ($page == "") $page = 1;

// 시작 레코드 구함
$from_record = ($page - 1) * $rows;

?>
© SIRSOFT
현재 페이지 제일 처음으로