SFB Posted May 19, 2006 Share Posted May 19, 2006 I was wondering if there was a way to write data in a file just before ?>. It would be helpfull. I could just remove ?> and putt it back in when i write over the file again but I dont feel like doing it that way. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 19, 2006 Share Posted May 19, 2006 I'm not sure what you're talking about, are you writing code to a PHP file and want to start inside the ?> ? There's not a way to start at a specific offset. Just remove the last few characters and then include them in what you write. Link to comment Share on other sites More sharing options...
SFB Posted May 19, 2006 Author Share Posted May 19, 2006 i guessed that people wouldnt undersand. well rember when i was working on a login script. I should have just posted it in that one. I will go back to that topic and things be more clear again. Link to comment Share on other sites More sharing options...
calvin182 Posted May 20, 2006 Share Posted May 20, 2006 one thing you could do is put a variable before the ?> so when it writes, it adds whatever jazz the variable has, and if the variable is empty then no extra stuff is added. Link to comment Share on other sites More sharing options...
Nakor Posted May 21, 2006 Share Posted May 21, 2006 You can open the file in read mode, read backwards 2 characters, put that into a variable, then read backwards to the beginning and put that in a variable. Then you can close the file and open it again in write mode. You can then re-write all of the beginning from the second variable, append whatever you want to write, and then put on the first variable to close it. Link to comment Share on other sites More sharing options...
SFB Posted May 21, 2006 Author Share Posted May 21, 2006 I really shouldnt have made this new topic. it related so much to my old one i got all the help i needed there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now