Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $imageArray = range(1,100);
- $c = count($imageArray);
- $tab = "\t";
- $itemsPerBlock = 8;
- echo '<ul class="thumbs">'."\n";
- for ($i = 0; $i < $c; $i++){ // Storing the count in a variable ($c) will increase your script speed/resources.
- if($i > 0 && ($i % $itemsPerBlock) === 0){
- // Modulus (%) will simply return the remainder of deviding the numbers. 6 % 4 = 2; 27 % 8 = 3;
- echo '</ul>' . PHP_EOL . '<ul class="thumbs">' . PHP_EOL;
- // 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.
- }
- echo "\t" . '<li><a href="images/gallery/model/' . $imageArray[$i] . '" /><img src="images/gallery/thumbs/' . $imageArray[$i] . '" /></a></li>' . PHP_EOL;
- }
- echo '</ul>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement