RE: File opening, writting and location
| From: | Tim Ward | Date: | Fri, 04 Jan 2002 09:42:04 +0000 |
| Subject: | RE: File opening, writting and location | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79438@lists.php.net to get a copy of this message | ||
http://www.php.net/manual/en/ref.filesystem.php
<http://www.php.net/manual/en/ref.filesystem.php>
everything you need is
here, in particular fgets.
What you'll need is something like ...
If ($fhandle = fopen("filename", "r"))
{ while ($fline = fgets($fhandle) && ++$count < $X)
{ echo($fline);
}
}
this is untested but should work
Tim
www.chessish.com <http://www.chessish.com>
----------
From: RRNews [SMTP:GNOVAK@wi.rr.com]
Sent: 03 January 2002 03:20
To: php-general@lists.php.net
Subject: File opening, writting and location
I'm a newbie to PHP and the web.
I've been programming in VB for about 3 years and XBase for about
15.
I would like to place a bunch of text files in a directory and have
a PHP
script pick them up and place the top X lines in a center section of
a page
followed by a MORE link. It would do this for Y number of articles.
The
remainder it would title with the first x characters and place it on
the
right of the screen (like an archive)
I know that I can use a function similar to fopen in XBase to access
the
text files and extract the lines.
In Xbase, I would traverse the directory, extract the lines, place
the X
characters in a string followed by a "More".
If anyone can steer me in the right direction, I would appreciate
it. I
don't get how you place things on the page in a given area. I'm
using
Dreamweaver 4 templates.
Anyone have any suggestions.....
Thanks in advance...
Jerry