Listing a Directory
I would like to add a page to my wordpress site that basically just lists a directory on my server. (Ex. /wp-content/data/)
Is there some PHP or HTML code that will help me do this? Is it possible to have all of the files listed linked to themselves?
I have files that are in a directory. And I need some sort of script that will list all of them, and have them linked.
I have over 200 small files that I don’t want to type out and link them.
Is there some sort of script?
something like this
Exactly. Something like that. But more like this:
Can you help?
well i took another script and just modded it a little to fit inside wordpres
ill zip up the couple files i have and upload them if you want to work with what i have and just edit it to your needs
ok here it is, i hope that i made the instructions simple enough 🙂
I have used it and it is almost perfect.
I wonder, could the display of the directory be displayed in the blog pages, rather than on its own blank page?
Is it possible to make the listing handle directories? Presently, if directory listing is switched off, then an error occurs when trying to enter a directory, and if it is not, then the user clicks on a directory and is sent to the standard webpage directory listing, which is fugly.
Anyone know how to get round these?
There was recently another solution to this. It is called indexer.php. My memory fails me as to where I got it. However, if you do a search here, you should find the link. I use it on my site for a Downloads page. Check it out and see if that is what you need – http://www.jwurster.us/wordpress/.
Thanks for the reply. Indexer.php is actually contained in the download above, and I have it working. However, issues are twofold (bearing in mind I am an all-but-complete newbie at this).
1) If I create a page (rather than post), then that page is not displayed as part of the blog, but it its own page. I’d like the listing to be displayed like the blog posts.
2) The listing is not recursive (is this the right word?). It’s fine for listing 100 files, but it doesn’t work when the directory in question has sub-directories.
I want to use the webpage created to deliver company news and information, and this involves offering a large number of files, which need to be sorted by directory (there are 6 languages for each file, for example).
Any ideas how I can get this working? I have my pages designed and ready to go. Displaying the files as they are organised in a directory as part of the blog pages is the last thing I need to do, having got the rest sorted very quickly and easily.
I have my Downloads Page as a Page on my blog. Did you use the Page Template “indexer” as your template?
I also wanted to display the files in sub-folders. I have started looking for a solution, but maybe a quick email to the indexer developer would help.
I did indeed use that template. The link to the page is certainly part of the blog (under “Pages”), but when clicking on the page link, it clears everything in the browser window and just shows the directories. It does not appear “embedded” as part of the blog like a post does, and that’s really what I want.
Who is the developer? Sounds like hbalagh just tweaked someone else’s code.
Ideally I suppose I need a post that lists the selected directory by using some code, but that’s just so far beyone me. 🙁
- The topic ‘Listing a Directory’ is closed to new replies.