A Digital Age Deserves A Digital Leader

Need to display a directory on a page kinda

Need to display a directory on a page kinda

Postby xxsonyboy4lfexx » Tue Jan 29, 2008 8:17 pm

I need to take a directory and display all the files on a web page. But add in like CSS so I can change the fonts etc. Can this be done?
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Postby ar1stotle » Wed Jan 30, 2008 5:04 am

I'm not really sure how to do that... you'd need to find a way to display all the files in a html file to link to the CSS... and I don't know how you'd do that :(
Image
Image
PRO BRONZE
User avatar
Posts: 3841
Joined: Sun May 16, 2004 1:59 am
Location: New Orleans, Louisiana

Postby c0ldfyr3 » Wed Jan 30, 2008 5:40 am

can be done with php, i will look for the post from a while back, i asked for this once too.
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby c0ldfyr3 » Wed Jan 30, 2008 5:51 am

Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby xxsonyboy4lfexx » Wed Jan 30, 2008 4:53 pm

Umm I don't know PHP so is there something I need to put before and after that code? It is just coming up as text.
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Postby xxsonyboy4lfexx » Wed Jan 30, 2008 5:04 pm

http://tournamentgamingworld.com/downloads.php
There's the page. I added the php thing before and after the code so now it's longer code
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Postby c0ldfyr3 » Thu Jan 31, 2008 2:12 am

you need to add
Code: Select all
<?php

before
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby c0ldfyr3 » Thu Jan 31, 2008 2:12 am

and
Code: Select all
?>

after
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby c0ldfyr3 » Thu Jan 31, 2008 5:31 am

you could also try this here...

Code: Select all
<?

/**
 * Change the path to your folder.
 *
 * This must be the full path from the root of your
 * web space. If you're not sure what it is, ask your host.
 *
 * Name this file index.php and place in the directory.
 */

    // Define the full path to your folder from root
    $path = "/hsphere/local/home/";

    // Open the folder
    $dir_handle = @opendir($path) or die("Unable to open $path");

    // Loop through the files
    while ($file = readdir($dir_handle)) {

    if($file == "." || $file == ".." || $file == "index.php" )

        continue;
        echo "<a href="$file\">$file</a><br>";

    }

    // Close
    closedir($dir_handle);

?>
Image
PRO Level 15
User avatar
Posts: 1346
Joined: Sun May 02, 2004 8:49 pm
Location: 127.0.0.1

Postby xxsonyboy4lfexx » Thu Jan 31, 2008 5:39 pm

Ill be honest I don't know what to change in that code ^
Image
PRO Level 8
User avatar
Posts: 315
Joined: Sat Jan 07, 2006 4:42 pm
Location: California

Next

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron
cron