View previous topic :: View next topic |
Author |
Message |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Tue Feb 22, 2005 10:12 pm Post subject: Script? |
|
|
This one is complicated I think
Can anyone make me a script that displays the content of a whole folders .txt files? So like the stuff in the txt file. With some sort of seperating thing in between to symbolize that it's a different file. Thanks! |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Feb 23, 2005 12:26 am Post subject: Re: Script? |
|
|
Code: |
<HTML>
<HEAD>
<TITLE>Listing</TITLE>
</HEAD>
<BODY>
<?php
/* $path should be "." if you want to process the diretcory where */
/* the script is located */
$path=".";
$i = 0;
$dir = opendir($path);
while($file=readdir($dir))
{
if (is_readable($path . "\\". $file) && ereg(".\.txt", $file))
{
echo "<H1>$file</H1><FONT COLOR=" . ($i%2==0?"blue":"red") . "><PRE>";
$fd = fopen ($path . "\\". $file, "r");
while(!feof($fd))
echo htmlentities(fread($fd, 4096));
fclose($fd);
echo "</FONT></PRE>";
$i++;
}
}
closedir($dir);
?>
</BODY>
</HTML>
|
PHP is nice. Isn't it? :-) _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Wed Feb 23, 2005 12:44 am Post subject: |
|
|
Can you suggest something that will limit the width the text file take up? |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Thu Feb 24, 2005 1:33 am Post subject: |
|
|
glyde51 wrote: | Can you suggest something that will limit the width the text file take up? |
You can limit the width by applying a style to the HTML elements. Use CSS for a better formatting of the output. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Thu Feb 24, 2005 2:02 am Post subject: |
|
|
http://www.trielite.net/glydeblog/data
I tried to use tables, but I can't get it to work, I also tried putting some CSS tags just outside the PHP, but that didn't work either. Any ideas? |
|
Back to top |
 |
 |
|