Scenario :I am trying to build a Mobile Entertainment Portal. It will enable users to download Music & Movies to their Cell Phones…
Problem Exp : Suppose I upload 100 folders of Songs, each folder is for one Album. I want a way to generate a page with all the folders name (Album Name) in it. If user click on the page, they should be taken to a page where they get list of all songs in the album. Clicking on any song name will let them download it. Can it be done anyway or will I have to manually design each of the 3 pages for each album. If I do that, its time consuming and also will be difficult to change anything like footer, header…
First of all, this is a weighted question. But I will try to answer some of your questions to get you started.
You can scan for directories using
scandir()in PHP.So, now that you know how to do that, perhaps instead of trying to create a separate page for each album folder you could use one script and based on the
GETvars, display the appropriate content. e.g.Now let’s see how that might work with the above example:
Then to get the files, when you’re looping through the directories, instead of checking if it is a directory, check that it’s not a directory and that will give you your files. (e.g.
if (!is_dir(...)