This script shows all images from directory, with name and size. Ant I want to do that the newest images will be on the top(sort by data)or something like that. Maybe somebody can help me?
<?
echo '<center>
<br />
<table>
<tr>
';
$main = "direktorija";
$dir = opendir($main); // unbutton it
$i = 1;
&n bsp; // for column count
$qpg = "index.php?page=adresas&ids=";
if (isset($_GET['ids'])) {
$ids = $_GET['ids'];
} else {
$ids = 1;
}
$nk = 0;
$count = 10;
$start = $count * $ids;
$stop = $count * $ids + $count;
while($filename = readdir($dir))
{
$nk ++;
{
if ( $filename != "index.php" and $filename != "." and $filename != "..") & nbsp; {
// nk =1 start >= 1; nk-
if ($start == $nk) {
if ($stop > $nk ){
$start++;
&n bsp; // dont show index.php (this file) - skip any file you dont want viewed
&n bsp; // format as ( & & $filename != "filename.ext" ) inside the () behind "index.php"
if ($i <= '2') & nbsp; // column count (designed for 5 columns wide - change the 5 for however many wanted)
{
$i = $i + '1';
echo ' <td align="left" width="115" height="100">
<img& nbsp;src="'.$main.$filename.'" height="128" border="0" /></a><br />
<font size="1" face="tahoma"><b>'.$filename.'</b><br />'.filesize($main.$filename).' bytes<br><br></font>
</td>
'; & nbsp; // display it
} else {
$i = '1'; & nbsp; // reset column count and change rows
echo ' </tr>
<tr>
';
$i = $i + '1'; // add 1 to counter to get to next row
echo ' <td align="left" width="115" height="100">
<img& nbsp;src="'.$main.$filename.'" height="128" border="0" /></a><br />
<font size="1" face="tahoma"><b>'.$filename.'</b><br />'.filesize($main.$filename).' bytes<br><br></font>
</td>
'; & nbsp; // display it
}
}
}
}
}
}
closedir($dir); // button it up
echo '
</tr>
</table>
</center><br>
';
$idm = $ids-1;
if ($idm == 0) {
$idm = 1;
}
$idp = $ids+1;
echo "<center><a href=\"$qpg$idm\"><<< </a>";
$np = -1;
for ($nki=0;$nki < $nk;$nki+=$count) {
$np++;
if ($np != 0) {
echo "<a href=\"$qpg$np\">$np </a>";
}}
if ($idp > $np) {
$idp = $np;
}
echo "<a href=\"$qpg$idp\">>>></a></center>";
?>
sort by data
Started by ennio, Sep 17 2005 06:28 AM
1 reply to this topic
#1
Posted 17 September 2005 - 06:28 AM
#2
Posted 17 September 2005 - 06:35 AM
You can see script: http://www.pliusas.c...ex.php?page=000 but without sorting.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
