Complete User Control of Output
Problem
You want to combine some of the above techniques to give the end user full control of the output of a directory listing.
Solution
Place the following HTML in a file and use it as the header for your directory listing:
<form action="" method="get"> Show me a <select name="F"> <option value="0"> Plain list</option> <option value="1" selected="selected"> Fancy list</option> <option value="2"> Table list</option> <select> Sorted by <select name="C"> <option value="N" selected="selected"> Name</option> <option value="M"> Date Modified</option> <option value="S"> Size</option> <option value="D"> Description</option> <select> <select name="O"> <option value="A" selected="selected"> Ascending</option> <option value="D"> Descending</option> <select> <select name="V"> <option value="0" selected="selected"> in Normal order</option> <option value="1"> in Version order</option> <select> Matching <input type="text" name="P" value="*" /> <input type="submit" value="Go" /> <form>
Discussion
Several of these recipes show how to let the end user specify formatting options in the query string. However, they’re likely not going to know about this.
This recipe allows you to give the end user the full bag of tricks, and lets her select various formatting options right there in the page. If you save the above HTML as header.html, you can use this in your directory listing with the HeaderName directive:
HeaderName /header.html
The user can than select various options, reorder ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access