Hi. Thanks for taking the trouble to reply.
Unfortunately, it definitely does it in my copy and it's driving me mad!
Using Apply Source Formatting doesn't help as it makes it worse...
<div> <a href="link"> <img src="piccy" /> </a> </div>
...which I'm sure is nice and compact and good practice and all that, but not what I want!
Still seeking a solution...
Go to Edit > Tag Libraries and select HTML tags. The controls the way tags are displayed in Code view.
If the tags are set up the way you want, and Apply Source Formatting still messes up your code, there's definitely something odd about your Dreamweaver installation. However, I'm sorry, I don't have a clue as to what might be causing it. Wish I could be of more help.
I'm having this same problem. Adobe (like Microsoft) insists on thinking it knows
what you want more than you do. Why can't they leave my code alone. I did not
ask DW to rewrite my code & I've been trying to stop it for months. I'm thinking
of dumping Adobe altogether because of this.
The code below is always having tabs and spaces removed from the left and ruining my readablity
<div> <!-- kong div -->
<input type="checkbox" name="toys" value="kong" />
Kong Chew Toy (red)
<span price="13.50" class="price floatRight">
<input name="kong.quantity" type="text" disabled="disabled" value="1" size="8" />
</span><br class="clearIt" />
<div> <!-- kong options div -->
<input type="radio" name="kong.option" value="small" checked="checked" />
<input type="radio" name="kong.option" value="medium" />
<input type="radio" name="kong.option" value="large" />
<input type="radio" name="kong.option" value="xlarge" />
</div> <!-- end of kong div -->
Yeesh. The fact that DW does not (normally) rewrite code is the primary reason I chose DW years ago when I was looking for (near) WYSIWYG editors.
Not sure where to go from here. Any chance following step #4 Delete the FileCache.dat file helps? Or maybe going back into the preferences and toggling the line feeds one way, then back again - quitting DW in between? I know, I'm fishing, but this is definitely not normal behavior.
Mark A. Boyd
I'm sorry to hear you're having these issues. But I'm glad to find this post. I'm hoping this issue's voice gets louder! I've started and replied to many threads about this so I'm going to be a little short. The best way to describe what happens to me is to share the following YouTube video.
This video is my problem. I've found no answers to it. I've shared this video with Adobe. Nothing. I've shared it with others like yourselves. Nothing. This happened in CS3 and now CS4. I'm spending pretty good money on these suites but I'm still using DW 8 because it leaves my code alone. I can't take advantage of the latest DW CS4 because it trashes my code. I may have some bad practices from time to time with my HTML mark up but... I'll deal with that on my own time. Thank you very much.
I sure wish somebody, including Adobe, could provide me with something to work with. We're on Coldfusion 8 server now. But I can't take the risk of using DW CS4, with all the new CF tag support, because of this issue. I just can't take the chance. I'd like to take advantage of Adobe Bridge and it's integration with all my CS programs, most importantly DW CS4 but... I can't use DW CS4.
The code rewriting preferences have no affect so far. I've asked my ALL KNOWING DW CS4 to leave all files with the .cfm extension ALONE but my ALL KNOWING DW CS4 does not listen.
What am I missing?
This happened in CS3 AND CS4 so I'm not thinking it's an installation issue.
Sorry...I thought I was going to make this short. What a total bummer though.
I second (third? forth?) the above frustrations. It drives me round the bleeding bend - when you tick a box that says "Never rewrite code", you kind of expect it to work.
So fine, that doesn't work. I'll let DW rewrite my code, but I don't want ruddy universal rules for each tag... sometimes it's appropriate for img tags to be on their own line, sometimes it makes sense for them to be on the same lines as other tags. For people who mostly work in Code View and care about the format of their code, THIS MATTERS. It's like Word deciding where to end your paragraphs for you.
Adobe, I love you, and you do wonderful things, but it's these little things that sometimes make me want to eat my own head in pure anger. Or maybe, you know, use Netbeans. Sort your QA out.
So. I too would love to hear if anyone's found a solution to this.
It is exact the same thing on my installation. If I am using some palettes and enter for example a new URL and hit enter DW rewrites my code in a way that is not traceable. Often the following line looses all indents. That is quite ugly and stops me (sometimes) using the "helpful" GUI.
Another example is attached. I just added an image above a list and the <ul> goes at position 0 and its <li> goes one tab to the left.
dw_code_rewriting.png 10.7 K
The problem in your video was fixed for CS4. Unfortunately, the Mac Xcode compiler optimized away the fix, and it wasn't caught in time, so it's not fixed for Mac until the next release.
I'm glad to see that you discovered how to work around the problem (i.e. closing the client tags inside the server-side tags).
At least DW CS3 isn't REVERSING your tags like it's doing to me.
I'm am working in a CFC function, and that function dynamically builds a multi-tiered unordered list. So my cfloops and cfswitches often have opening and closing XHTML tags that seem to DW to be orphans. The final output is valid XHTML, but that shouldn't matter: It's a bunch of strings stored via <cfsavecontent /> inside a CFC function. Yet DW CS3 (Mac) flips 4 of my CFML closing tags every time I open the file!
This is what I typed:
<cfloop condition="intLevelLast GTE 1">
I save it and my CF server runs it beautifully with no errors. Then I open it to edit in DW and I get this in its place:
</cfdefaultcase><cfloop condition="intLevelLast GTE 1">
It's like it just flips, spacing and all. I have turned off every rewrite and validation thing in DW and nothing. I'm about to finally move over to CFEclipse because I don't have time to mess with this. I only use DW to develop applications and design XHTML templates.
I recall this happening to me a couple of years back using DW8. If someone knows what the deal is I'd appreciate a hint. Thanks!
I guess my problem is not directly related to yours after all, as I discovered a hack to live with DW's bad behavior in my case. I found this when I used DW to try to collapse the tags that were getting fouled up and seeing it not know exactly what to do.
The solution below tricks DW into thinking that my HTML tags are all nested properly, and it no longers rewrites the code in my CFC's function. Because nesting fixed it, I'm guessing the original poster's spacing issue is unrelated.
Nevertheless, here's what I did:
<cffunction ... >
<cfset var strHTML = "">
<!--- a memorable and always false condition --->
<cfset var hellfreezesover = False>
<!--- Trick DW into submission --->
<!--- Trick DW into submission --->
<!--- Trick DW into submission --->
</li><!--- close last open li --->
Search your Dreamweaver application directory for the "Tag Libraries" folder and re-name it. Dreamweaver will not then be able to find it's code re-writing preferences. Since this essentially renders it into a state of having no preferences at all, it will not rewrite your code.
If you want to disable code rewriting for just one file type, go in the "Tag Libraries" folder and rename just the folder for that file type. You can still keep the code rewriting for the places where you do want it if you can bear to forego the satisfaction of outwitting Dreamweaver's crazy, useless checkbox for "Never rewrite..." and having your own code stay put all the time in every file.
Can't help because I have a similar problem which is driving me crazy!
I have a page with DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
Now you'd think that CS3 would pay attention to that, but when I open the page with code rewrite on it changes everything to XHTML! i.e. <br> becomes <br />!
Then just for fun I run the CS3 validator on it and it says the changes are all invalid! What can I say but a huge bug. Only cure is to turn off code rewriting altogether.
It didn't USE to do this but now it does. wtf?
Of course DW also has always done stupid rewrites like when a line has
it will often rewite it to:
Having same problem with links, selected "Do not encode special characters" in preferences but it still does it, driving me crazy!
Goes from this
Obviously wont work!!