Jump to content

Making a list of folders


apina

Recommended Posts

Hi!

 

I'd like to make a REALLY SIMPLE www gallery index page, that:

- gets a list of subfolders and lists them on the page

- gets a "folderdescription.txt" file from each directory and displays it's contents beneath each folder

- shows a thumbnail for each folder (in each folder: folderthumbnail.jpg)

 

Then, based on that info I quess I could write easily also the gallery code itself.

 

So, I'd need a list of the subfolder names as some vector or something. That's what I don't know how to do...

 

Just help with the PHP part is needed - I can handle the HTML...

Link to comment
https://forums.phpfreaks.com/topic/101530-making-a-list-of-folders/
Share on other sites

Assuming its one directory you want to open with your subdirectories in it. you shoul duse something like this.

 

$dh = opendir($dirpath);
while (false !== ($file = readdir($dh))) {
if (!is_dir("$dirpath/$file")) {
echo "<span class=maintxt>". str_replace("_"," ",$file) ."</span><br />";
echo "<a class=maintxt href=";
echo $dirpath.$file;
echo ">";
echo "Download This file";
echo "</a><br /><br />";
}
}
closedir($dh);

 

Which loops and shows you all the files and all the folders and offers a download, not so sure about the thumbnails though not worked with pics all too much.

I'd like to make a REALLY SIMPLE www gallery index page, that:

- gets a list of subfolders and lists them on the page

- gets a "folderdescription.txt" file from each directory and displays it's contents beneath each folder

- shows a thumbnail for each folder (in each folder: folderthumbnail.jpg)

 

YOu basically have to pick - do you want a 'really simple' page, or do you want all that information? Its not the simplest deal to do what you speak of.

Thanks for the answer! I'll try that soon.

 

I'm capable of programming complex things. It's just that I don't know the PHP commands & syntax for getting this file info - for example, if I just knew the names of the subdirectories, I can modify that code to make <img > tags of the thumbnails, links to the directories, and so on...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.