Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $chars = glob('*', GLOB_ONLYDIR);
- $screens = array_reverse(glob($_GET['char'].'/*.{png,jpg}', GLOB_BRACE));
- ?>
- <!-- The header prints all array items, in my personal case it would be the 3 character folders (Harrison, Davis, Brown). -->
- <div id="header">
- <span class="header-text">
- <span class="einfo">Ordered by: Newest First</span>
- <!-- str_replace replaces the underscores (in the filenames) to blank spaces for easier readability. -->
- <?php foreach ($chars as $char) : ?> <a href="?char=<?= $char ?>"><?= str_replace('_', ' ', $char); ?></a> <?php endforeach; ?>
- </span>
- </div>
- <div id="main">
- <!-- 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'. -->
- <?php foreach ($screens as $screen) : ?> <a href="<?= $screen ?>" target="_blank"><img src="<?= $screen ?>" class="thumb"></a> <?php endforeach; ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement