Здравейте,
знам че е коментирано много пъти но ненамерих тема в която е дадено код койно неизисква база данни
та можете ли да ми кажете как да паказвам по 10 картинки на страница
ето ми кода:
доста голяма част от него е пикан от мен но нз как да ограничавам по колко да са на страниза ПЛС Хелп
Благодаря предварително
знам че е коментирано много пъти но ненамерих тема в която е дадено код койно неизисква база данни
та можете ли да ми кажете как да паказвам по 10 картинки на страница
ето ми кода:
Код:
<!doctype html public "-//w3c//dtd html 4.01 transitional//en">
<html>
<head>
<meta http-equiv="content-language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>WBG</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<script language="JavaScript" type="text/javascript">
<!-- ;
var newwindow;
var wheight = 0, wwidth = 0;
function popimg(url, title, iwidth, iheight, colour) {
var pwidth, pheight;
if ( !newwindow || newwindow.closed ) {
pwidth=iwidth+30;
pheight=iheight+30;
newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=50,left=10');
wheight=iheight;
wwidth=iwidth;
}
if (wheight!=iheight || wwidth!=iwidth ) {
pwidth=iwidth+30;
pheight=iheight+60;
newwindow.resizeTo(pwidth, pheight);
wheight=iheight;
wwidth=iwidth;
}
newwindow.document.clear();
newwindow.focus();
newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> <\/head> <body bgcolor= \"' + colour + '\"> <center>');
newwindow.document.writeln('<a title="Hit to close!" href="javascript:window.close();"><img src=' + url + ' border=0></a>');
newwindow.document.writeln('<\/center> <\/body> <\/html>');
newwindow.document.close();
newwindow.focus();
}
function tidy5() {
if (newwindow && !newwindow.closed) { newwindow.close(); }
}
</script>
<body bgcolor="#ECF5FF" text="#3399FF" leftmargin="20" topmargin="10" marginwidth="10" marginheight="10">
<?php
include("config.php");
$cols = 2;
echo "<table width=100% border ='1' bordercolor='#3399FF' cellpadding='10' cellspacing='6'>
<tr>";
$opendir =opendir($path_thumbs);
$i =1;
while ($file = readdir($opendir)) {
if($file != '..' && $file !='.' && $file !=''){
if (!is_dir($file)){
$imgsize = getimagesize ($path_big."/".$file);
// lets get the file size in byte/kb/mb.
$file_size = filesize($path_big."/".$file);
if ($file_size >= 1048576){
$show_filesize = number_format(($file_size / 1048576),2) . " MB";
}elseif ($file_size >= 1024){
$show_filesize = number_format(($file_size / 1024),2) . " KB";
}elseif ($file_size >= 0){
$show_filesize = $file_size . " bytes";
}else{
$show_filesize = "0 bytes";
}
//define a variable to hold everthing that will be printed in table's columns.
$all_stuff = "Име:<b> $file</b> <hr size=1>
<a href=\"javascript:popimg('$path_big/$file','$file', $imgsize[0], $imgsize[1],'white')\">
<img src=\"$path_big/$file\" border=\"0\" width=\"440\"></a>
<br>Големина: $show_filesize
<br>Дължина: $imgsize[0] px
<br>Ширина: $imgsize[1] px";
//divide the loop ($i) and ($cols) if the result is integer
//then print column number 1.
if (is_int($i / $cols)){
echo "<td align='center' valign='top' bgcolor='#F2F2F2'>$all_stuff</td></tr><tr>";
}else{
//else then print column number 2 etc for the next loop.
echo "<td align='center' valign='top' bgcolor='#F2F2F2'>$all_stuff</td>";
}
//add only 1 for the loop ($i).
$i++;
}
}
}//end while loop
closedir($opendir);
clearstatcache();
// print the rest of table.
echo "</tr>
</table>";
//print copyright ;)
echo"<p align=\"right\"> </p>
</body>
</html>";
Благодаря предварително