The Apache web server has, for it’s PHP environment, if that is it’s server language, the concept of …
… so that, for the website of the webpage you are reading from now, a URL such as our RJM Programming’s Landing Page’s URL …
https://www.rjmprogramming.com.au/
… scours that Document Root folder to find the index.php webpage code to display that Landing Page.
You can “abstract”, and we do also with our Difference Reporting, what that Document Root is as a folder path … bit forlorn we know, as we’ve shown what it is, probably, in many tutorial images … but the thing here is that a URL such as …
… is understood and gets you to our Landing Page as well, because to the public, Document Root is the limit of where they are allowed to surf … if you like Document Root is the left hand beach flag at Surfers Paradise (or perhaps the right hand beach flag in the Todd River … when it gets water, that is?!).
Okay, that’s one theme of today’s new PHP web application. The other we wrote out to ourself was …
One line ls -clt https://www.rjmprogramming.com.au/*.txt via find $_SERVER[‘DOCUMENT_ROOT’] -type d -name ‘*’
… as a presentation idea whereby just the one table row of data is used to present …
- https://www.rjmprogramming.com.au/
- dropdown of list of folders off Document Root (“abstracting” Document Root itself … ie. relative referencing)
- a file specification (minus the path) of interest … we are, for now, locking in as …
*.txt
… as the input data, to the output data that is … - output folder listing (as for Linux and macOS)
The concept of “one table row” for a multiple file listing is a mute point, but in our defence …
- the textarea it is presented in (via rows=1) is user resizable
- the textarea it is presented in is given a title with line feeds for the whole report so that non-mobile users can see this on hovering over the textarea
This was a PHP project definitely needing the mildly better outcomes of PHP shell_exec (where multiple line outputs are possible) as distinct from exec where only the last output line is returned, but is the usual method we use around here.
Keeping the report to one row also asks for …
- use of elements that have CSS styling display:inline; as a default (eg. span element) … or …
- user supplying CSS display:inline; or display:inline-block; as applicable … and …
- table cell text-align:right; came in handy … as well as …
- select element “dynamic shrinker” …
function resizeSelect(sel) { // thanks to https://www.google.com/search?q=make+select+element+width+in+sympathy+with+length+of+its+value&rlz=1C5OZZY_en&oq=make+select+element+width+in+sympathy+with+length+of+its+value&gs_lcrp=EgZjaHJvbWUyBggAEEUYOdIBCTI3MzEzajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8
// 1. Create a temporary span to measure text width
var tempSpan = document.createElement('span');
tempSpan.style.visibility = 'hidden';
tempSpan.style.position = 'absolute';
tempSpan.style.whiteSpace = 'pre';
// 2. Set font styles to match the select box
tempSpan.style.font = window.getComputedStyle(sel).font;
// 3. Set content to selected text
tempSpan.innerText = sel.options[sel.selectedIndex].text;
document.body.appendChild(tempSpan);
// 4. Update width (with extra space for the dropdown arrow)
sel.style.width = (tempSpan.offsetWidth + 30) + 'px';
document.body.removeChild(tempSpan);
}
… in the “proof of concept” one_line_find.php first draft Document Root Relative Folder Listing web application you can “crank up” below if you like …
If this was interesting you may be interested in this too.


