Brent -- ...and then Brent Baisley said... % % Sorry. Since you were looking to use <br>, I thought you were creating % HTML content. But then, line feeds are ignored in HTML so then you
Well, yes and no.
% wouldn't have a problem with them. I should have thought of that.
Well, yes and no :-) It's my app, and it's understandable that you don't
already know everything about it from having not seen it yet!
%
% How are you reading the file? The key being that you said you read it
% "line by line". Once you read a line, could you just grab the first
% length-1 characters and then do your parsing on that?
The data file format is
field@@data
field@@data
...
and a real example is
comment@@this is a comment
latdir@@N
londir@@W
latdec@@36
londec@@89
...
and my code [now, after mods,] looks like
...
if ( file_exists($filelocation) ) # do we have an info file?
{
$newfile = fopen($filelocation,"r"); # grab it and start reading!
while ( !feof ($newfile) ) # (go only until the end, of
course)
{
$commentline = trim(fgets($newfile)); # get one line with whitespace
trimmed
if ( $commentline ) # a line with data?
{
list ($field,$data) = preg_split("/@@/",$commentline); # split it
$content[$field] = preg_replace("/<br>/","\n",$data) ; # replace our swapped
'<br>'s with original '\n's and store it in the hash
}
}
fclose($newfile); # always lock up
}
...
so I'm just using fgets to read it. The reason it looks that way is
because, after the user has had the opportunity to edit the fields and
hits the button, I process the data as
...
$newfile = fopen($filelocation,"w");
foreach ($keylist as $k) # loop thru keys
{
fwrite($newfile,"$k@@".ereg_replace("(\n|\r)+","<br>",stripslashes(${base64_encode($k)}))."\n")
; } # write the clear text out
fclose($newfile);
...
Although I've solved the problem for now, the next version will probably
end the data with a @@ and so I can just read another line if I don't
have a closer.
Thanks again & HAND
:-D
--
David T-G * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg78115/pgp00000.pgp
Description: PGP signature

