listFiles.php
So far this is the only library we've created. It now has four published functions:
So far this is the only library we've created. It now has four published functions:
This displays the files matching path (which should end in a pattern). The files are listed in ASCII order of their filenames. The files are displayed as a bulleted list (using HTML <ul>) with the name of each file being the text of the link--with two exceptions: Any underscore in the filename is displayed as a space, and if a filename starts with a series of digits followed by an underscore (in order to force a particular ordering) those digits and the underscore are not displayed.
The path is passed on to the underlying OS as-is; this means you can take advantage of Unix's fairly powerful globs. For instance a path ending in 'Fall_2*[13579].pdf' would display only those PDFs whose filenames start with Fall_2 and end in an odd number. (Please be careful with the path.)
If you want to display the files in reverse order, append a comma and 'rev' to the function call.
This displays the files matching path in a table with the specified number of columns. The rules for path are the same as for displayFilesAsList(). If you want to reverse the order, append a comma and 'rev' to the function call.
By default, tables are displayed with cells going top to bottom then left to right. If you need to display the cells from left to right then top to bottom, use this function instead. The rules for path are the same as for displayFilesAsList(). If you want to reverse the order, append a comma and 'rev' to the function call.
<?php require_once '/ip/uirrwww/inc/listFiles.php';
displayCampusTable('/ip/uirrwww/wwws/doc/notes/campus_test/*');
?>
This displays the files in path in a 'campus table'. The files must be named according to an exact pattern (see below). A campus table has seven columns, one for each of the seven campuses. The rows of the table go from newest to oldest.
In order to show up in the table, the filenames must end with an underscore, a campus code, another underscore, and four digits. (Then the file extension.) Examples: 'completions_IUB_2015.pdf', 'IPEDS_Academic_Libraries_IUB_2015.pdf' . There must be an underscore in front of the campus code. So, for instance, '_IUB_2015.pdf' is the shortest possible name for the Bloomington 2015 PDF file.
Here are the campus codes:
These correspond to Bloomington, IUPUI, East, Kokomo, Northwest, South Bend, and Southeast.
The only text that appears in the body of the campus table is the four-digit year. Thus, 'inst_char_IUB_2007.htm' would simply appear as '2007' in the table (under the Bloomington column), and so would 'grad_rates_IUB_2007.htm' . Please don't put two files with the same campus and year in the same folder.
Let us know if you have any questions, or find any bugs.