|
Posted by Bimperial on 02/05/07 12:02
On Feb 5, 2:15 am, "Kimmo Laine" <s...@outolempi.net> wrote:
> "Bimperial" <bimper...@gmail.com> wrote in message
>
> news:1170656518.954965.10050@k78g2000cwa.googlegroups.com...
>
>
>
> > Just another newb here in need of a little help....and probably some
> > sleep as well ;) I'm just getting started with PHP reading all I can
> > get my hands on, on and off line. I have simple bit of code that
> > displays a list of mp3 files from a different directory from which the
> > script runs in.....
>
> > <table align=CENTER bgcolor=#ffffff cellpadding=4 cellspacing=0
> > border=2>
> > <tr><th>Song Title</th></tr>
> > <?php
> > $dir = "../songs/";
>
> > // Open a known directory, and proceed to read its contents
> > if (is_dir($dir)) {
> > if ($dh = opendir($dir)) {
> > while (($file = readdir($dh)) !== false) {
> > echo "<tr><td> <a href=\"$dir\">$file</a> "."</td></tr>";
>
> how about:
> echo "<tr><td> <a href='$dir/$file'>$file</a> </td></tr>";
>
> > }
> > closedir($dh);
> > }
> > }
> > ?>
>
> > the display is fine, I'm just pulling my hair out trying to get the
> > link to the individual files set correctly, but alas everything I've
> > tried so far bombs out. I do not know how to add the file name along
> > with the directory in the href ;(
> > Can somebody set me straight please......? Then I'll go to bed ;) TIA
>
> Maybe you should try pottery or painting, you know... Something where you
> work with your hands instead of your brain.
>
> --
> "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpkhttp://outolempi.net/ahdistus/- Satunnaisesti päivittyvä nettisarjis
> s...@outolempi.net | rot13(x...@bhgbyrzcv.arg)
LOL ...it had to be soo simple eh ........too tired to see the trees
for the forest ;) Thanks Kimmo!!
Now that I've had a little sleep, how would I go about adding another
directory to read from, to display along with the mp3 file list? I
have related word docs that contain lyrics and keys to display along
with the songs, I tried adding "or" to the if statements but I don't
seem to have a handle on how to do this yet, your help is appreciated!
<?php
$dir = "../songs";
$dir2 = "../docs";
// Opens known directories, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "<tr><td><a href='$dir/$file'>$file</a></td><td></
tr>";
}
closedir($dh);
}
Bob
}
?>
Navigation:
[Reply to this message]
|