ich hab mich doch gar nicht beschwert...
warum gleich so genervt?
warum gleich so genervt?
<?php
function pagebrowser($pages, $link, $page, $offset){
$prev=$page-1;
$next=$page+1;
if(($page - $offset) < 1){
$prevOffset = $page - 1;
}
else{
$prevOffset = $offset;
}
if(($page + $offset) > $pages){
$nextOffset = $pages - $page;
}
else{
$nextOffset = $offset;
}
$start = ($page - $prevOffset);
if($page != 1){
echo ("<a href=\"$link?page=$prev\"><< zurück</a> | ");
}
if ($page - $prevOffset > 1){
echo ("<a href=\"$link?page=1\">1</a> | .. | ");
}
for($x=$start;$x<=($page+$nextOffset);$x++){
if ($x != $page){
echo (" <a href=\"$link?page=$x\">$x</a> ");
}
elseif($x == $pages){
echo " <span class=\"fliesstextfett\">$x</span> ";
}
elseif($x == $page){
echo " <span class=\"fliesstextfett\">$x</span> ";
}
}
if ($page + $nextOffset < $pages){
echo (" | .. | <a href=\"$link?page=$pages\">$pages</a> ");
}
if($page != $pages){
echo (" | <a href=\"$link?page=$next\">weiter >></a>");
}
}
$cols = 5;
$rows = 2;
//Bilder einlesen
$bilder_array = array();
$bilder_dir=opendir ("thumbs/");
while ($bilder = readdir ($bilder_dir)){
$bilder_filter = substr("$bilder", 0, 2);
if($bilder != "." && $bilder != ".." && $bilder_filter == "t_"){
$short_menue1 = str_replace("t_", "", $bilder);
array_push ($bilder_array, $short_menue1);
}
}
sort($bilder_array);
$count = count($bilder_array);
if($count>($cols*$rows)){
$sides = ceil ($count/($cols*$rows));
}
else $sides_=_1;
$k=isset($_GET['page'])?(($_GET['page']-1)*$cols*$rows):0;
echo "<table>";
for ($i=0;$i<$rows;$i++){
echo "<tr>";
for ($j=0;$j<$cols;$j++){
if ($k < $count){
echo "<td><a href=\"bestellen.php?bild=$bild\">";
echo "<img src=\"thumbs/t_".$bilder_array[$k]."\">";
echo "<br>vergroessern/bestellen</a></td>";
}
else
echo "<td> </td>";
$k++;
}
echo "</tr>";
}
echo "<tr><td_colspan=$cols_align='center'>";
pagebrowser($sides, "index.php", $page, 5);
echo "</td></tr>";
echo "</table>";
?>
Kommentar