I've been staring at google, stack, and other sites for 4 days trying to get my head around this, so I appreciate any help you can offer... I'm a n00b, so apologies if I misuse any terms.
What I'm trying to do:
I'm trying to build a band website just for practice. I want to create a block of code that stores multiple pieces of information about a song, then use that data in a music player. Each song will have its own player that will show the title of the song, a piece of art for the song, and allow you to play the song itself.
To keep the site loading time down, and to avoid repetitive code, I'd like to use a loop to make it so I have one chunk of code for the player(s), then create a separate iteration of the player for each song.
I think I can handle the loop aspect, but I can't figure out which data type to use for storing multiple pieces of info about the song. Would this be an array, a function, something else?
I'm not looking for someone to code this for me, I just want to know what direction head in.
Here's a rough sketch of what I mean, without proper syntax obviously:
$song(crashing) {
$songTitle = "Crashing";
$songPath = "crashingSong.php";
$songArtwork = "crashingArt.php";
}
$song(Juliana) {
$songTitle = "Juliana";
$songPath = "julianaSong.php";
$songArtwork = "julianaArtwork.php";
}
$player {
echo "<div class=\"titleHead\">" . $songTitle . "</div>";
echo "<div class=\"link\">" . $songPath . "</div>";
echo "<div class=\"artwork\">" . $songArtwork . "</div>";
}
Then I would have a loop that would iterate the player for each song.
Help?