Advertisement
fidle89

LSRP Screenshot Gallery

Feb 7th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.99 KB | None | 0 0
  1. <?php
  2. $chars = glob('*', GLOB_ONLYDIR);
  3. $screens = array_reverse(glob($_GET['char'].'/*.{png,jpg}', GLOB_BRACE));
  4. ?>
  5.  
  6. <!-- The header prints all array items, in my personal case it would be the 3 character folders (Harrison, Davis, Brown). -->
  7. <div id="header">
  8.     <span class="header-text">
  9.         <span class="einfo">Ordered by: Newest First</span>
  10.         <!-- str_replace replaces the underscores (in the filenames) to blank spaces for easier readability. -->
  11.         <?php foreach ($chars as $char) : ?> <a href="?char=<?= $char ?>"><?= str_replace('_', ' ', $char); ?></a> <?php endforeach; ?>
  12.     </span>
  13. </div>
  14.  
  15. <div id="main">
  16.     <!-- This foreach loop (and the one above) prints out each image from the respective directory (of that character) accompanied with the required HTML - all in a reverse order. Voila, 'newest first'. -->
  17.     <?php foreach ($screens as $screen) : ?> <a href="<?= $screen ?>" target="_blank"><img src="<?= $screen ?>" class="thumb"></a> <?php endforeach; ?>
  18. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement