Web Analytics Made Easy -
StatCounter List Files - CodingForum

Announcement

Collapse
No announcement yet.

List Files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • List Files

    Hi, I'm currently using this -

    PHP Code:
    <?

    //define the path as relative
    $path "./";

    //using the opendir function
    $dir_handle = @opendir($path) or die("Unable to open $path");

    //running the while loop
    while ($file readdir($dir_handle)) 
    {
       echo 
    "<li><a href='$file'>$file</a></li>";
    }

    //closing the directory
    closedir($dir_handle);

    ?>
    But is there a way so it only displays .html files?
    markaylward.co.uk

  • #2
    PHP Code:
    // use
    if(($pos strpos(tolower($file), '.html')) !== FALSE && $pos == strlen($file) - 5) echo ...

    // instead of
    echo ... 
    dumpfi
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))¯/.
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.

    Comment


    • #3
      Thanks!

      Although that was supposed to be 'strtolower', but nm, got it working now.
      markaylward.co.uk

      Comment

      Working...
      X