Jump to content

Baldry

New Members
  • Posts

    1
  • Joined

  • Last visited

Baldry's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I am pretty new at PhP so its pretty hard for me to writh a code but i am trying my best. i have a folder with 200+ images and i would like to show 10 at a time for 1 page and so on everything i got is $iPicturesPerSite = 10; $output = ''; $files = glob('../images/'.$sSearchFor.'*.{jpg,png,gif}',GLOB_BRACE); $iSite = 1; if(isset($_GET['iSite']) && is_numeric($_GET['iSite']) && $_GET['iSite'] > 0){ $iSite = $_GET['iSite']; } $iMaxBildNummer = $iPicturesPerSite * $iSite; if($iMaxBildNummer > sizeof($files)){ $iMaxBildNummer = sizeof($files); } for($i=(($iPicturesPerSite*$iSite)-$iPicturesPerSite); $i<$iMaxBildNummer; $i++){ $size = getimagesize($files[$i]); $output = $output.$this->_simpleTpl("tpl/item.tpl",array( 'showName'=> basename($files[$i]), 'imagewidth' => $this->width, 'fileName'=>'images/'.basename($files[$i]), 'resolution'=>$size[0]."x".$size[1], 'fileSize' => round(filesize($files[$i])/1024), 'link' => '.link to file='.$files[$i])); } return $output; } it shows the first 10 images already but i dont knopw how to do more. i cant get past the "put 10 in the first page than 10 in the next and so on" i tried $iMaxPageNummer = $iMaxBildNummer / $iPicturesPerSite; $this->$iMaxPageNummer = ceil($iMaxBildNummer / $iPicturesPerSite); for($p = 1; $p <= $iSite; $p++){ if($p == $iSite){ $tmp_pages[] = "{$p}"; }else{ $tmp_pages[] = "<a href='?page={$p}'>{$p}</a>"; } echo "<br />" . implode(" - ", $tmp_pages); } but this only showed a whole lot of 1-1-1-1-1- maybe i am just to new to the php stuff. some help would be really nice (this is not the full code i already have a search option for images) Thanks EDIT: ahm most of the variables are german am sry about that but this is how i do it at the moment but you should see what is for what and if not just ask.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.