18 Replies Latest reply: Apr 28, 2010 6:23 PM by ericpresl RSS

    Stop Dreamweaver CS3 rewriting my code

    Two By Two Community Member

      I dearly hope one of you lovely people can help me as this program is driving me nuts!


      I need to find a way of stopping Dreamweaver CS3 from rewriting my code. I know it's a good thing for it to check for errors (unclosed tags, etc) and I have no problem with that, but what I need to stop is the way Dreamweaver keeps running closing tags on to the end of the previous line!


      For example, I type:




              <a href="link">

                  <img src="piccy" />





      which is lovely and structured and, above all, easy to read, but as soon as I edit an element's propery, Dreamweaver makes it:




              <a href="link">

                  <img src="piccy" />        </a>    </div>



      which is so annoying!


      I've tried turning off all code rewriting in the preferences, but to no avail.


      Please can someone save what little hair I have left?


      Thanks in desperation



        • 1. Re: Stop Dreamweaver CS3 rewriting my code
          David_Powers ACP

          I have never come across that problem before. However, you should be able restore order to your code by running Commands > Apply Source Formatting.

          • 2. Re: Stop Dreamweaver CS3 rewriting my code
            Two By Two Community Member

            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...

            • 3. Re: Stop Dreamweaver CS3 rewriting my code
              David_Powers ACP

              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.

              • 4. Re: Stop Dreamweaver CS3 rewriting my code
                echolte Community Member

                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 -->
                                    <label class="floatLeft">
                                        <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 class="priceDisp"></span>
                                    </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" />
                                            X Large
                                </div> <!-- end of kong div -->

                • 5. Re: Stop Dreamweaver CS3 rewriting my code
                  Mark A. Boyd Community Member

                  Turn off code re-writing in the preferences. When I do use the Command menu, I do not select any code - I run it on the whole document. Maintains my indentions and line feeds just as I've set them.


                  Mark A. Boyd
                  Keep-On-Learnin' :-)

                  • 6. Re: Stop Dreamweaver CS3 rewriting my code
                    Two By Two Community Member

                    That's my problem entirely Mark - I have already turned off code rewriting in the prefs!


                    In a word... AAARGH!

                    • 7. Re: Stop Dreamweaver CS3 rewriting my code
                      Mark A. Boyd Community Member

                      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
                      Keep-On-Learnin' :-)

                      • 8. Re: Stop Dreamweaver CS3 rewriting my code
                        wr426f Community Member



                        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.

                        • 9. Re: Stop Dreamweaver CS3 rewriting my code

                          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.

                          • 10. Re: Stop Dreamweaver CS3 rewriting my code

                            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.

                            • 11. Re: Stop Dreamweaver CS3 rewriting my code
                              echolte Community Member

                              YUP , I've been saying it for months.

                              DW rewrites your code NO MATTER WHAT.

                              They don't acknoledge it , they woun't admit it , they have no explanation or solution.

                              Gotta love those "hard working enineers" at adobe.

                              The best solution , dump them and get a new IDE.

                              • 12. Re: Stop Dreamweaver CS3 rewriting my code
                                suntrop Community Member

                                … unfortunately. I really don't think it get fixed since it is a bug for years now. Some bugs we have to live with and learn to love :-)

                                So give Adobe a hug virtually and live in peace with you IDE

                                • 13. Re: Stop Dreamweaver CS3 rewriting my code
                                  Randy Edmunds Adobe Employee

                                  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).




                                  • 14. Re: Stop Dreamweaver CS3 rewriting my code

                                    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!

                                    • 15. Re: Stop Dreamweaver CS3 rewriting my code
                                      administerweb Community Member

                                      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>


                                          <cfsavecontent variable="strHTML">


                                              <li>first level

                                              <!--- Trick DW into submission --->
                                              <cfif hellfreezesover></li></ul></cfif>

                                              <cfloop ...>

                                                  <!--- Trick DW into submission --->
                                                  <cfif hellfreezesover><li></cfif>

                                                  <cfif closeit>






                                              <!--- Trick DW into submission --->
                                              <cfif hellfreezesover><ul><li></cfif>

                                              </li><!--- close last open li --->



                                          <cfreturn strHTML>


                                      • 16. Re: Stop Dreamweaver CS3 rewriting my code

                                        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.

                                        • 17. Re: Stop Dreamweaver CS3 rewriting my code
                                          GrantHorizons Community Member

                                          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:


                                                  <p>text</p>             </td>





                                          • 18. Re: Stop Dreamweaver CS3 rewriting my code

                                            Having same problem with links, selected "Do not encode special characters" in preferences but it still does it, driving me crazy!


                                            Goes from this


                                            to this

                                            http://.../sn/product_supercategory.jsp?sch_cat=Vertical Blinds&amp;nav_cat=-19942


                                            Obviously wont work!!