Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Location
    Sweden
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Display folder content on site

    Hi,
    I'm workning on a site where my client wants a page with a bunch of reports in pdf-format available for download. He'd like to just be able to put all of these pdfs in a folder on the server and have them automatically added to the html of the given page. (It needs to be easily updated with new reports.)

    Is this easily done with php? My php knowledge is very limited but I imagine I can't do it with javascript.

    I'm using drupal and found that the file_scan_directory function might be what I'm looking for but I'm not sure how to implement it.

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts
    might look at this ...
    http://www.nstoia.com/toh/listdir.php

  • Users who have thanked litebearer for this post:

    alandor (02-18-2012)

  • #3
    New to the CF scene
    Join Date
    Feb 2012
    Location
    Sweden
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks. I've been looking at this but can't figure out how to implement it in my page. If I wanted to add this function to one of my pages I imagine I would have to include this .php file in that page's html. But what then? Should I call the function dir_list($dir) from a php snippet in my html doc? And what value should the $dir parameter have?

  • #4
    New to the CF scene
    Join Date
    Feb 2012
    Location
    Sweden
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Great. I finally had the time today to try this script and it works by just pasting the whole thing into my html file. Probably violates every coding praxis there is but it seems to work.

    However, it would be less cumbersome if I could have this code in it's own php file and just call it by a simple function call from the html file. How would I do this? I just think it would make the html file more readable.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •