Spaces between content?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Spaces between content?

Post by Mr. Tech »

Im using a textarea to edit my html content and then fwriteing it back into the file. What seems to happen is content that looks like this:

<html>
<head>
<title>Title</title>
</head>
<body>
etc...


Ends up looking like this:

<html>

<head>

<title>Title</title>

</head>

<body>

etc...


Is there anyway to stop that?

Thanks
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

It depends how you're fwriting it out. It just looks like you are adding an extra \n when writing it but without seeing the code .... *shrug* ;)
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

LOL might help. Heres the code:

<?php
$fp=fopen($root.$filename,w);
fputs($fp,$text);
fclose($fp);
?>

The funny thing is it doesn't always happen....
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Hmm, looks ok (presuming the w was a typo and is actually 'w').
The extra newline must be coming from 'somewhere else' .. what OS is this on, windows, *nix, mac etc.. ? And when you say "it doesn't always happen" can you pin down exactly under what circumstances it does and does not happen?
Post Reply