Textedit deleted half a .php file

lupinloben

Registered
Hi everyone- I'm having a bit of a problem... It seems that somehow the first half of a .php file I had been working on has gone missing. When I open it in textedit it opens with formatting and everything, and it appears that all the linebreaks have been removed, along with about the first half of the code. The strange thing is, when I run it in firefox it processes normally as if it is reading the code and I just can't see it.

So, I'm hoping this means that somewhere on my computer is a chunk of this file that I can retrieve, because it would really suck to try to rewrite it all.


Let me know if this has happened to anyone else, or if you have any questions that might help troubleshoot this!

Thanks
 
Nevermind, I found out that opening it through the terminal using vim allows me to read the entire contents of the .php file. So, if anyone else has this problem, I suggest trying that.

Oh also, I'm running OSX Leopard 10.5.6
 
There are a bunch of coding text editors that are recommended for things like editing php files. I use TextMate - which si excellent if a bit pricey. I picked it up as part of a MacHeist bundle.
 
I'm a fan of TextWrangler myself. It's free.

I'll bet the problem with TextEdit is that it was parsing the file as HTML. TextEdit can open and edit HTML files, too, and this sometimes leads to strange and annoying results.
 
I concur with Mikuro. I like TextEdit, but trying to open an html file results in TextEdit actually trying to render the HTML as Safari would instead of showing the raw text.

I second the motion for TextWrangler (and its big brother, BBEdit).
 
although i usually prefer using some fullblown editor for coding, i'm using textedit all the time for quick previewing of files, among other things.

just turn off the html-parsing feature in TextEdits' prefs:
(that is, turn ON the 'igonre rich text commands...' option)
texteditprefs.png
 
Back
Top