/    Sign up×
Community /Pin to ProfileBookmark

Index page displaying folder content

Is there a way to create an index page (with customisable layout) that automaticaly lists the files contained in the same folder? The index page will update itself everytime a file is copied into the folder.

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 25.2006 — [code=php]
<?php
$files = glob("*");
echo "<ul>n";
foreach($files as $file)
{
if($file != '.' and $file != '..')
{
echo "<li>$file</li>n";
}
}
echo "</ul>n";
?>
[/code]
Copy linkTweet thisAlerts:
@hitmanauthorOct 25.2006 — Thanks NogDog! That's nearly what I'm looking for.

How can I add a hyperlink to each file listed so that people can just right-click and save on their computer?
Copy linkTweet thisAlerts:
@NogDogOct 25.2006 — Just add it to the echo line:
[code=php]
echo "<li><a href='$file'>$file</a></li>n";
[/code]
Copy linkTweet thisAlerts:
@hitmanauthorOct 25.2006 — Oh yeah! That's exactly what I was looking for! Thanks so much! I really appreciate.
×

Success!

Help @hitman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...