i wrote a class to do some simple work. supposed to get a variable and read the contents of a folder and put them up as a link. here's the class.
<?php
class viewandlink
{
function traverse($dir)
{
$tempdir = "D:\FoxServ\www\files\downloads\songs\cowboy bebop\$dir";
echo "tranversing $dir .... <BR>";
chdir($tempdir);
if(!($dp = opendir($tempdir))) die("can't open $tempdir.");
while($file = readdir($dp))
{
if($file != '.' && $file != '..')
{
echo "<A HREF=\"http://68.40.219.254/files/downloads/songs/cowboy bebop/$dir/$file\"TARGET=\"_self\">$file</A><BR>";
}
}
closedir($dp);
}
}
?>
this is the page for viewing the files
<?php
include ("link.inc");
$testing = new viewandlink();
$setdir = "boxset/cd1";
$testing->traverse($setdir);
$setdir = "boxset/cd2";
$testing->traverse($setdir);
$setdir = "boxset/cd3";
$testing->traverse($setdir);
$setdir = "boxset/cd4";
$testing->traverse($setdir);
$setdir = "ost1";
$testing->traverse($setdir);
$setdir = "ost2";
$testing->traverse($setdir);
$setdir = "ost3";
$testing->traverse($setdir);
?>
the problem is that it works fine. but when i put more than one folder to view. it screws up. not all of it, but just one line, the final output is like this
tranversing boxset/cd1 ....
02 - Tank!(TV Edit).mp3
04 - Want It All Back (Clavinet Hate Ver.).mp3
05 - Sax Quartet.mp3
07 - Encore Un Verre.mp3
08 - March For Koala.mp3
10 - Felt Tip Pen.mp3
11 - The Egg And You.mp3
13 - Pot City II (Yab's Dub).mp3
15 - NY Rush.mp3
17 - Fe.mp3
18 - Piano Black.mp3
20 - Spokey Dokey (Alternate Take).mp3
21 - Forever Broke.mp3
23 - Road To The West (With Rhythm).mp3
25 - Meteor.mp3
27 - Digging My Potato.mp3
29 - Rain (Female Vocal Ver.).mp3
31 - Green Bird.mp3
tranversing boxset/cd2 ....
02 - Cats On Mars.mp3
03 - Doggy Dog II.mp3
04 - Doggy Dog III.mp3
06 - Piano Bar I.mp3
07 - Give And Take.mp3
09 - Cat Blues.mp3
11 - The Singing Sea II.mp3
13 - ELM.mp3
14 - Waltz For Zizi.mp3
16 - Poor Faye (High Socks).mp3
17 - Farewell Blues (Alternate Take).mp3
19 - Words That We Couldn't Say.mp3
21 - Space Lion (Orgel Ver.).mp3
22 - Waste Land.mp3
24 - Goodnight Julia.mp3
25 - Space Lion.mp3
tranversing boxset/cd3 ....
tranversing boxset/cd4 ....
01 - Tank! (Live @ Shibuya AX).mp3
02 - Rush (Live @ Shibuya AX).mp3
03 - What Planet Is This (Live @ Shibuya AX).mp3
04 - Too Good Too Bad (Live @ Shibuya AX).mp3
05 - Bad Dog No Biscuit (Live @ Shibuya AX).mp3
06 - Call Me Call Me (Live @ Shibuya AX).mp3
07 - Mushroom Hunting (Live @ Shibuya AX).mp3
08 - The Real Folk Blues (Live @ Shibuya AX).mp3
09 - Piano Solo (Live @ Shibuya AX).mp3
10 - Ask DNA.mp3
11 - SF Game Center.mp3
12 - Rouya.mp3
13 - Old School Game.mp3
14 - Wandering Cowboy (Tank! with vocals), sung by Aoi Ed Tada.mp3
15 - Fascinating Horse Riding, sung by Ebara Andy Masashi.mp3
16 - Wandering Cowboy, karaoke version, sung with Ein.mp3
tranversing ost1 ....
01 - Tank!.mp3
02 - Rush.mp3
03 - Spokey Dokey.mp3
04 - Bad Dog No Biscuits.mp3
èXT€èXT€p://€¥û0.219.254/files/downloads/songs/cowboy bebop/ost1/05 - Cat Blues.mp3"TARGET="_self">05 - Cat Blues.mp3
06 - Cosmos.mp3
07 - Space Lion.mp3
08 - Waltz for Zizi.mp3
09 - Piano Black.mp3
10 - Pot City.mp3
11 - Too Good Too Bad.mp3
12 - Car 24.mp3
13 - Egg And I.mp3
14 - Felt Tip Pen.mp3
15 - Rain(Steve Conte).mp3
16 - Digging My Potato.mp3
17 - Memory.mp3
tranversing ost2 ....
02 - Fantaisie Sign.mp3
03 - Don't Bother None.mp3
05 - Live In Baghdad.mp3
06 - Cats On Mars.mp3
07 - Want It All Back.mp3
09 - You Make Me Cool.mp3
11 - Green Bird.mp3
12 - ELM.mp3
14 - Gateway.mp3
15 - Singing Sea.mp3
16 - The Egg And You.mp3
tranversing ost3 ....
Cowboy Bebop - Adieu.mp3
Cowboy Bebop - Call Me Call Me.mp3
Cowboy Bebop - See You Space Cowboy.mp3
Cowboy Bebop - Words That We Couldn't Say.mp3
see that part that's.. kidna weird?! èXT€èXT€p://€¥û0.219.254/files/downloads/songs/cowboy bebop/ost1/05 - Cat Blues.mp3"TARGET="_self">05 - Cat
i don't undertsand why it's doing this. so can someone please help me?
i'm still quite a newbie at php coding.. so any sort of help would be appreciated, that includes writing more effecient code if my code's kinda long winded.