Skip navigation
Currently Being Moderated

Stop Dreamweaver CS3 rewriting my code

Apr 7, 2009 5:13 AM

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:

 

<div>

    <div>

        <a href="link">

            <img src="piccy" />

        </a>

    </div>

</div>

 

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

 

<div>

    <div>

        <a href="link">

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

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

 

Peter

 
Replies
  • Currently Being Moderated
    Apr 7, 2009 5:21 AM   in reply to Two By Two

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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 8, 2009 5:10 AM   in reply to Two By Two

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2009 3:20 PM   in reply to Two By Two

    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)
                        </label>
                        <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 -->
                              
                            <label>
                                <input type="radio" name="kong.option" value="small" checked="checked" />
                                Small
                            </label>
                            <label>
                                <input type="radio" name="kong.option" value="medium" />
                                Medium
                            </label>
                            <label>
                                <input type="radio" name="kong.option" value="large" />
                                Large
                            </label>
                            <label>
                                <input type="radio" name="kong.option" value="xlarge" />
                                X Large
                            </label>
                        </div>
                    </div> <!-- end of kong div -->

     
    |
    Mark as:
  • Currently Being Moderated
    May 20, 2009 6:08 PM   in reply to Two By Two

    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' :-)

     
    |
    Mark as:
  • Currently Being Moderated
    May 21, 2009 3:21 PM   in reply to Two By Two

    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' :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 26, 2009 9:30 AM   in reply to Two By Two

    Hello,

     

    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.

     

    http://www.youtube.com/watch?v=g0LgQXDmr4s

     

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2009 3:42 AM   in reply to wr426f

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2009 7:44 AM   in reply to Two By Two

    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.

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2009 8:21 AM   in reply to suntrop

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2009 8:47 AM   in reply to echolte

    … 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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2009 8:57 AM   in reply to wr426f

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

     

    HTH,

    Randy

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 28, 2009 11:41 AM   in reply to Two By Two

    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:

     

                                </cfdefaultcase>
                             </cfswitch>
                        </cfloop>
                    </cfif>
                    <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:

     

                    </cfif>
                    </cfloop>
                        </cfswitch>
                             </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!

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 28, 2009 1:24 PM   in reply to Kevin Parker

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

        <ul>

            <li>first level

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


            <cfloop ...>

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


                <cfif closeit>

                    </li>

                <cfelse>

                    ...

                </cfif>

            </cfloop>

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


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

        </ul>

        </cfsavecontent>

        <cfreturn strHTML>

    </cffunction>

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2010 2:17 PM   in reply to Two By Two

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 20, 2010 11:59 AM   in reply to Two By Two

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

     

    OR:

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
      "http://www.w3.org/TR/REC-html40/loose.dtd">

     

    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

     

              <p>text</p>

          </td>

     

    it will often rewite it to:

     

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

     

    gah!!!

     

    Grant

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 28, 2010 6:23 PM   in reply to GrantHorizons

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

     

    Goes from this

    http://.../sn/product_supercategory.jsp?sch_cat=Vertical%20Blinds&nav_ cat=-19942

    to this

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

     

    Obviously wont work!!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points