Kenyans247 Forum

Welcome, Guest: Join Kenyans247 LOGIN!

Stats: 224 Members, 11,371 topics and 65 posts Date: Sunday 05 April 2020 at 02:58 PM
TrendingRecentNewestClassifiedDirectoryLivescoresLive Kenyan TVLive Kenyan Radio

PHP: Display a customizeable list of files in a directory

Kenyans247 / Science/Technology / Computers / PHP: Display a customizeable list of files in a directory (13 View's)

Php: Display A Customizeable List Of Files In A Directory Display Available Memory On Linux / Ubuntu How To Display All Posts On The Category Page In Wordpress Display A List Of Started Services From The Command Line (windows)
(Go Down) (» Reply topic)
PHP: Display a customizeable list of files in a directory by Kenyans247(m): Sun 22, March, 2020 10:25am
Apache gives you a list of files in an empty directory by default, but sometimes you will want to show a list of files that are in a directory through PHP so that you can customize the output of the list, and make a “pretty” listing of files. Here’s the basic code to make a list.



if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != "..")
{
$thelist .= ''.$file.'';
}
}
closedir($handle);
}
?>

List of files:





That’s about all you need to do. You could also put the list of files into an array if you felt like it, or use this as the beginning for a thumbnail page, which is what I used it for.

(» Reply topic) (» Go Up)

Recommended for you

» Display A List Of Started Services From The Command Line (windows) » Php: Display A Customizeable List Of Files In A Directory » How To Display All Posts On The Category Page In Wordpress » Display Available Memory On Linux / Ubuntu
Viewing this topic:
1 guest(s) viewing this topic

Sections: Romance, How To, Politics, K247 Intelligence, Environment, Education, Innovation, Computers, Building/Architecture, Universities, Jokes Etc, K247 TV, Events, Photography, Poetry, Tanzania Forum, Somalia Forum, Ugandan Forum, South Sudan Forum, Burundi Forum,

Kenyans247 - Copyright © 2019 - 2020 Sande Kennedy. All rights reserved. See How To Advertise.
Disclaimer: Every Kenyans247 member is solely responsible for anything that he/she posts or uploads on Kenyans247.