Jump to content

cbox


Recommended Posts

Posted

Looking for a way to dynamically collect file urls, names as well as directories using html.

 

Like:

<html>
<body>
<div style="overflow:auto; height:300px; width:300px">
<table cellpadding="0" cellspacing="0" style="width:250px;">
	<tr>
		<!-- Code Here --!>
	<tr>
<table>
<div>
<body>
<html>

 

I know that the /'s aren't there, ignore that. I just need a way to collect names/urls from my games directory and display them in a scrollbox. I already have a scroll box, and have tried multiple ways of listing files. None work.

 

The whole point is to remove the idea of me doing it all manually, as there will be hundreds of files.

Posted

HTML just displays info, I don't think theres anyway for it to pull it.

 

 <?
// Define the full path to the folder whose contents you want to list
$path = "/home/user/public/foldername/";
// Open the directory
$dir_handle = @opendir($path) or die("Error opening $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
  if($file == "." || $file == ".." || $file == "index.php" ) { continue; }
  echo "<a href=\"$path\"$file\">$file</a><br />";
}
// Close
closedir($dir_handle);
?>

 

This will display ALL files in the directly its listed in. So place it in your folder with ALL those files, then name this file index.php. It should work, I'll look up parsing into listbox.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...