22, November 2008

Directory browsing prob - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Directory browsing prob
« previous next »
Pages: [1] Print

Author Topic: Directory browsing prob  (Read 585 times)
OMG!I am geek
**
Gender: Male
Posts: 56
374 credits
Members referred : 0



« on: Sep 25, 2005, 06:33:41 PM »

I would like to create a script that will be able to browse a directory, and display links with the html files.

For example if the file called a.html it should produce <a href=/directory/a.html>a</a>

Can you please help me on this?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8249
42481 credits
Members referred : 3



« Reply #1 on: Sep 25, 2005, 06:50:25 PM »

Ok here is your code :

Code:
<?php
ini_set
('display_errors',1);
$dir 'zen/docs'// <- This should be a directory in your http path not in the filesystem. Do not add a slash in the end
$dh=opendir($dir);

while(
false !== ($file=readdir($dh) ) )
{
    if ( 
strtolower(substr($file, -4)) == 'html' )
    {
       echo 
'<a href="' $dir '/' $file '">' substr($file0,-5) . '</a><br />';
    }
}
?>


Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=443
Tags : html Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Directory browsing prob
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 11:14:05 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.735
Total Topics: 7.650
Total Members: 4.395
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: lightbyte

29 Guests, 4 Users online :

14 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.