作者Jahn (Somson)
看板java
标题[问题] 相片张数分页的问题?
时间Mon Jul 4 21:54:20 2011
请问各位高手大大
使用下列程式码的方式程现照片
但不管多少照片都呈现在都一页
我也写一个分页程式,但不管我按
第一页或第二页它都呈现1~14张
(我一页呈现14张)
请各位大大指导一下 我是否那边
有错 谢谢
<?php include "header.php" ?>
<link rel="stylesheet" rev="contents" href="Styles/album.css" />
<?php
if( is_null( $_GET['book'] ) ) exit;
$book = $_GET['book'];
$dirs = scandir("Album");
$AlbumName = iconv("big5","utf-8", $dirs[$book] );
$img = scandir( "Album/".$dirs[$book])
?>
<h1>活动剪影 - <?=$AlbumName?></h1>
<div style="width:90%; overflow:hidden; margin-bottom:50px;">
<?php
$listnum=14; //显示的张数
$bb=ceil(count($img)/$listnum); //页数 count($img):总数
if($k<=$bb)
{
$start=($k-1)*13+1; //开始的笔数
$D =$k*13; //结束的笔数
for($i=$start ;$i<=$D; $i++ )
{
$imgPath = "Album/".$dirs[$book]."/".$img[$i];
if( is_dir($imgPath) ) continue;
$photoName = iconv( "big5", "utf-8", $img[$i] );
if( $photoName == "Thumbs.db" ) continue;
$size = getimagesize( $imgPath );
if( $size[0] > $size[1] )
{
$ratio = 100/$size[0];
$height = $size[1]*$ratio;
$limit = ' width="100" style="margin-top:'.round((100-$height)/2).'px;
margin-bottom:'.round((100-$height)/2).'px" ';
}
else
$limit = ' height="100" ';
?>
<li class="photoLi" onmouseover="Over(this)" onmouseout="Out(this)"
onclick="showPic(<?=$i?>)">
<img src="<?=iconv("big5","utf-8",$imgPath)?>" border="0" <?=$limit?>
/><br />
<span style="font-size:12px"><?=$photoName?></span>
</li>
<?
}}
?>
<?php
?>
</div>
<?php
for($k=1;$k<$bb;$k++)
{ ?>
<a href="AlbumShow.php?book=<?=$book?>&page=<?=$k?>"><? echo $k?></a>
<?
}
?>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.227.129.203
1F:→ james732:贴错板了 07/04 21:54
2F:→ tkcn:真意外,这次居然不是 javascript XD 07/04 22:21