Advertisement
gitlez

Untitled

May 12th, 2011
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <?php
  2. $imageArray = range(1,100);
  3. $c = count($imageArray);
  4. $tab = "\t";
  5. $itemsPerBlock = 8;
  6.  
  7. echo '<ul class="thumbs">'."\n";
  8.  
  9. for ($i = 0; $i < $c; $i++){ // Storing the count in a variable ($c) will increase your script speed/resources.
  10. if($i > 0 && ($i % $itemsPerBlock) === 0){
  11. // Modulus (%) will simply return the remainder of deviding the numbers. 6 % 4 = 2; 27 % 8 = 3;
  12. echo '</ul>' . PHP_EOL . '<ul class="thumbs">' . PHP_EOL;
  13. // PHP_EOL is a php constant for End Of Line. Depending on the type of server. (Unix, Windows, Mac), it will use the appropriate signal.
  14. }
  15. echo "\t" . '<li><a href="images/gallery/model/' . $imageArray[$i] . '" /><img src="images/gallery/thumbs/' . $imageArray[$i] . '" /></a></li>' . PHP_EOL;
  16. }
  17. echo '</ul>';
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement