Current location: Hot Scripts Forums » Programming Languages » PHP » Anyone have any ideas?


Anyone have any ideas?

Reply
  #1 (permalink)  
Old 12-20-03, 01:31 PM
enfilade enfilade is offline
New Member
 
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Anyone have any ideas?

Does anyone have any ideas on where I can get something that I can implement into a page of a site I'm making that will create text links to every file in a certain directory, this will also have to automatically update when I add or remove a file from that directory. If anybody has any ideas or knows of a script of somesort, I'd appreciate it greatly.
Reply With Quote
  #2 (permalink)  
Old 12-20-03, 02:11 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi there,

Something like the following should do.

PHP Code:

<?PHP


// Directory to list the files from. Should be a relative path.
$dir './';

if (
$dh opendir($dir)) {
    while (
$file readdir($dh)) {
        
// Strip out '.', '.', .htaccess, etc.
        
if (substr($file01) != '.') {
            echo 
'<a href="'.$dir.$file.'">'.$file."</a><br />\n";
        }
    }
    
closedir($dh);
}

?>
This script lists all the files in the specified directoty upon load, so the users will see the up-to-date version always (with an exception of cache). You can do a little more with directory related functions of PHP.

You can find a good resource here:
http://ca3.php.net/dir

Cheers.
__________________
Blavv =|
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can they SUE? based on same features, ideas, concept? soccer The Lounge 6 01-20-09 05:28 AM
Need to pull LATEST record... any ideas? Soulidified PHP 4 11-14-03 04:11 PM
Proven PHP Script not working on Windows 2000 server – any ideas? chimchim PHP 5 11-13-03 09:16 PM
Application ideas keithmangan PHP 0 09-29-03 11:24 AM
Need to submit form to database and text file - Any ideas how? dpreiss ASP 1 08-21-03 06:02 PM


All times are GMT -5. The time now is 07:38 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.