michaelsanford
Translator, Web Developer
PHP:
$i = shell_exec("ls -1 ./mus_library/scarlatti/");
$i = str_replace("\n", "<br />", $i);
echo $i;
I have about 300 files I want to link to on my site, each has an associated PDF and MIDI (the score and the MIDI representation).
I obviously don't want to manually link all the files, so I'm using the above code to print a directory listing.
How can I work it so I get line items like this:
(filename without extension) | Download PDF | Download MIDI
?
BTW Dominico Scarlatti's pieces are identified by the K catalogue (like the M-Messier or NGC-New Galactic Catalogue numbers) so identifing the pieces by filename is acceptable...
I was thinking of filling an array like $files[] with each line item, but I don't know how to split the $i output so that the entire value of $i isn't put in $file(1)...
Any other suggestions are welcome.