Mess in php file when edited on different computers?
I work home with Dreamweaver cs5 on windows 7 and on work on windows xp Dreamweaver cs5.5 When i edit file home and open it from ftp on my work all spaces between lines of code double when i get home and open file there are additional space line added to each emp开发者_高级运维ty line why is this happening?
e.g.
if (true) {
test();
};
now looks like
if (true) {
test();
};
and this is everywhere. Also sometimes rarely i open file and my php code does not have no new lines its all on the same big line like this.
if (true) { test(); };
Someone knows whats the problem here?
Maybe it will be not best answer, but...
Dreamweaver is wrong tool, use normal IDEs - PhpStorm or NetBeans.
- Open the file
- Click CTRL + F
- Select "Current document" in "Find in" (You can also select the folder if you have multiple files)
- Search in "Source code"
- Tick "Use regular expression"
- Type
"[\r\n]{2,}"
(without quotes) in "Find" - Type
"\n"
(without quotes) in "Replace" - Press "Replace All"
This is something that does come up with Dreamweaver and it happens when you're on a Windows machine and you download a file from a Unix server.
There's a fairly easy fix to immediately get rid of the extra line breaks at least, if that's the current issue, and to prevent them in the future:
http://www.jaredstenquist.com/2009/02/13/removing-extra-linebreaks-and-spaces-in-dreamweaver/
When removing extra line breaks, it will remove all empty breaks so be sure this is what you want - you may have to create some manual breakss over again.
As for line breaks not appearing in rare cases, I suspect setting line break type to match your sever's as suggested in that article may address that issue as well.
精彩评论