Created
August 5, 2014 19:25
-
-
Save k0nsl/b9075ed60db0241410c5 to your computer and use it in GitHub Desktop.
List files using glob()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- modPDF.php <k0nsl> --> | |
<div class="maintitle">Recently Added eBooks:</div> | |
<p><br><center><a href="/?new"><img src="/graphs/My-Ebooks-icon.png" border="0" title="" alt="" /></a></center></p> | |
<br> | |
<?php | |
$show = 10; | |
$dir = '/home/neophyte/public_html/WNLibrary/Portabel Documents/'; // Leave as blank for current | |
if($dir) chdir($dir); | |
$files = glob( '*.{pdf}', GLOB_BRACE ); | |
usort( $files, create_function('$b, $a', 'return filemtime( $a ) - filemtime( $b );') ); | |
for ( $i = 0; $i < $show; ++$i ) | |
echo '« <a href="/Portabel Documents/', $file = $files[$i], '">', $file, '</a><br />', "\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment