Re: New as of today
| From: | Justin Garrett | Date: | Fri, 30 Aug 2002 07:00:35 +0000 |
| Subject: | Re: New as of today | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114606@lists.php.net to get a copy of this message | ||
Look at fgets and explode. Depending on the format of your txt file you can
use a combination of fgets and explode to get your desired results.
http://www.php.net/manual/en/function.fgets.php
http://www.php.net/manual/en/function.explode.php
If each picture name is on a separate line then the following will work:
while (!feof($zFile)){
$buffer = fgets($zFile, 4096);
echo "<a href=test.php>$buffer</a><br>";
}
Justin Garrett
"Stu9820" <stu9820@westga.edu> wrote in message
news:3D467BF1@cliff.westga.edu...
> Im new to PHP (came from ASP). I'm trying to make pictures (.jpgs) come
out
> of a folder and display on a page. Here is my code so far:
>
> <?php
> $fileLoc = "Bid2002/pictures.txt";
> $zFile = fopen($fileLoc, "r");
> $zContents = fread($zFile, filesize($fileLoc));
> fclose($zFile);
> echo "<a href=test.php>$zContents<br></a>";
> ?>
>
> I dont have database support on the server i use (school server). I have
all
> the picture names in a text file and i want to pull out the name of
pictures
> from the text file and make it pull out of the picture folder. Is there
an
> easier way to do this? Or is this the best way. ASP is very because you
can
> loop through the file and I thought I could do it with php but it ends up
in
> one big link. Thanks in advance.
>
> Jeff
> UWG Student
> stu9820@westga.edu
>