24 Replies Latest reply: Nov 23, 2012 5:45 AM by MurraySummers RSS

    DW CS5 modify template head anomaly

    akribie Community Member

      Hi

       

      I have an established site based on a single template with external css defined outside an editable region below the default editable region into which the page title can be inserted.

       

      To override a CSS class on one page, I added the new style into the title editable region which is above the point where the external css gets included, but this does not result in the modified style being applied.

       

      To overcome this, I added an additional editable region just above the </head> tag in the template expecting that it would propagate across the site when saved.

       

      What actually happened was that the editable region relocated itself to just below the <head> section both in the template and the child pages - ie to after the </head> tag and before the <body> tag.  If I move the new editable region so it is no longer the final line before the </head> tag, then it works as expected.

       

      This smells like a bug in CS5, but before I report it I thought I'd better check to see if this is a universal issue or just on my system.

       

      Comments please.

        • 1. Re: DW CS5 modify template head anomaly
          MurraySummers CommunityMVP

          This smells like a bug in CS5, but before I report it I thought I'd better check to see if this is a universal issue or just on my system.

           

          More than likely it's a problem in your code.  We can't know what this is without seeing your page and its code.  Can you help with that?

          • 2. Re: DW CS5 modify template head anomaly
            akribie Community Member

            Well, the code validated OK in DW with no errors and looked OK to me, but you're welcome to see if you can spot something in the head region where the problem occurred.  Edit Region 5 is what caused the problem - below it is in the position that works - nothing else is different.  I have removed my Google Analytics ID and added two CAPITALISED comments to show where the problem occurred.

             

            The trigger for the unwanted move was saving the template and propagating the change to child page, which resulted in the move both in the template and the children.  If there was an error, then I would expect an error message of some sort, not unilateral unwanted editing.

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

            <html xmlns="http://www.w3.org/1999/xhtml">

            <head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

            <!-- TemplateBeginEditable name="doctitle" -->

            <title>Forum</title>

            <!-- TemplateEndEditable -->

            <!-- TemplateBeginEditable name="head" -->

            <!-- TemplateEndEditable -->

            <link href="../ACA2.css" rel="stylesheet" type="text/css" />

            <script src="../js/ACA2.js" type="text/javascript"></script>

            <script type="text/javascript">

            var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

            document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

            </script>

            <!-- TemplateBeginEditable name="EditRegion5" --><!-- TemplateEndEditable -->

            <script type="text/javascript">

            try{

            var pageTracker = _gat._getTracker("UA-xxxxxxx-14");

            pageTracker._trackPageview();

            } catch(err) {}

            </script>

            <!-- EDIT REGION CREATED HERE-->

            </head>

            <!--  THIS IS WHERE DW MOVED THE EDIT REGION WHEN INSERTED IMMEDIATELY BEFORE THE </HEAD> TAG -->

            <body>

            <div class="container"> <a name="pageTop"></a>

            • 3. Re: DW CS5 modify template head anomaly
              MurraySummers CommunityMVP

              Try this again on that page.  I'm sure you were affected by cosmic rays or something .  There is absolutely nothing there that could cause something like this to happen.  And anyhow, DW doesn't ever move editable regions within the code.

              • 4. Re: DW CS5 modify template head anomaly
                akribie Community Member

                Thanks, Murray.

                 

                Problem still there having tried again after the umpteenth restart of DW, but maybe I didn't observe it carefully enough in detail before or perhaps the behaviour has changed a little after several inserts and removals.  It think the latter, but am not 100% certain.

                 

                Opening a blank line in the code immediately above the </head> tag and then inserting a new editable region using the topline Insert menu now causes the editable region to appear just below the <body> tag without saving the template.  The template seems otherwise to be perfectly OK to me, so I still favour a quirk in DW.

                 

                Given that I've fixed the problem by moving the region, I'm reluctant to spend too much more time on it, but if it recurs I'll submit a possible bug report.

                • 5. Re: DW CS5 modify template head anomaly
                  akribie Community Member

                  I just created a new blank template in a different DW site on my system, opened up a blank line above the </head> tag and inserted a new editable region.  The region appeared below the <body> tag, not where the insert point was positioned.

                   

                  Grateful if you would try it as well.

                   

                  If you get the same result, it's a bug.  If not, it's a local quirk.

                  • 6. Re: DW CS5 modify template head anomaly
                    MurraySummers CommunityMVP

                    I'm definitely not able to reproduce your results in any version of DW back to DW2!

                     

                    And why are you feeling the need to insert another editable region in the head anyhow, in addition to the stock two that are always placed there?

                    • 7. Re: DW CS5 modify template head anomaly
                      akribie Community Member

                      Thanks again, Murray.  Must be a tangled installation here, then.

                      • 8. Re: DW CS5 modify template head anomaly
                        MurraySummers CommunityMVP

                        Why do you need this extra editable region anyhow?

                        • 9. Re: DW CS5 modify template head anomaly
                          akribie Community Member

                          It had been my understanding that CSS within a page had higher priority than the same declaration in an external CSS file.  However, when I put a CSS override into the existing editable region near the top of the <head> section, the subsequent import of the external CSS declaration took priority.  I therefore tried to insert another editable region into the <head> section below the import of the external CSS file.  This exposed the problem discussed above.

                           

                          I later found that I am able to successfully insert a new editable region higher up than just above the </head> tag, so I have done it that way and the local override now works as expected.

                          • 10. Re: DW CS5 modify template head anomaly
                            MurraySummers CommunityMVP

                            It had been my understanding that CSS within a page had higher priority than the same declaration in an external CSS file.

                             

                            That would only happen if the embedded CSS came AFTER the link to the external file.

                             

                            There is no restriction on where in the Template's head region you can (manually) insert an editable region (you cannot do it using DW's UI), as long as it's a legal location (and immediately before "</head>" is certainly legal).

                             

                            You could have just as easily moved the stylesheet link so that it occurred before the embedded stylesheet.

                            • 11. Re: DW CS5 modify template head anomaly
                              coramichel2 Community Member

                              I'm experiencing the same thing.  I need to make my meta tagging editable within each page to match the particular subject.  So I tried inputting an editable region right above the last line of the </head> and it automatically moved it to just after the <body> tag.  Of coure, my meta tags won't work there.

                               

                              However, I did notice that using an editable region farther up in the <head> section does allow me to put the meta tagging into the document I need it to go into.  So perhaps try higher up in the <head> section.

                              • 12. Re: DW CS5 modify template head anomaly
                                akribie Community Member

                                Thanks.  I found that you could add an extra editable region anywhere in the <head> section except immediately before </head> or, of course, use the existing editable region higher up the <head> section if that suits your task, so our results are consistent.

                                 

                                Interesting that you found the same problem, but Murray didn't.  I'm using Win7 Pro.  I wonder if Murray is using a Mac and whether you are another Win user?

                                • 13. Re: DW CS5 modify template head anomaly
                                  coramichel2 Community Member

                                  Yes, I'm using Win 7 and have DW CS5. So that may be the case. Glad you found a solution.

                                  • 14. Re: DW CS5 modify template head anomaly
                                    MurraySummers CommunityMVP

                                    I am using both Mac and W7-64.  I can guarantee you that this is not a DW issue.  There is absolutely no difference between an editable region below the <head> tag or above the </head> tag as far as DW is concerned.  If the editable region is being moved, someone is doing it inadvertantly.

                                    • 15. Re: DW CS5 modify template head anomaly
                                      akribie Community Member

                                      Murray,

                                       

                                      Whilst I agree with you in theory, the 'someone' who is moving the inserted editable region is living inside, not outside, the computer - in my case at least.  I've been using DW for years and this is something that has only come to light because of trying this specific insert for the first time. There is absolutely no finger trouble here and, it would seem from corramichel2, that it is not restricted to my system.

                                       

                                      Thanks for responding, but I cannot accept your 'guarantee' just because you seem not to be able to reproduce the problem on your own systems.  The cause is either a bug or the result of a subtle corruption of the DW configuration somewhere, since it affects both new sites and old here.  Given DW's propensity for suddenly generating javascript errors when trying to select recent files for FTP for no obvious reason, the application seems to be vulnerable to configuration glitches, so maybe that's the cause here, too.

                                       

                                      Anyway, there is an adequate workaround for this, whatever the underlying cause, and it may never be a significant issue again in my workflow, so I'm leaving it here.

                                      • 16. Re: DW CS5 modify template head anomaly
                                        MurraySummers CommunityMVP

                                        I've been using DW since DW2, and have written the only book yet published on DW Templates and Library items.  Not only have I never observed something like this happen, but I have never seen anyone else describe it on these forums since the early 2000's.  I can confidently assure you that there would be no difference in how DW would handle any editable region on the page, much less in the head region only.  Really.

                                         

                                        If you can define a series of steps that will allow you/me to reproduce this effect, I'll be happy to take it to the development team.

                                        • 17. Re: DW CS5 modify template head anomaly
                                          akribie Community Member

                                          Murray,

                                           

                                          Having read your posts for many years on these forums, I have the greatest respect for your knowledge of web programming and use of DW, but even you cannot expect to have encountered every little subtlety in using the software.  Neither does the lack of previous reports have any bearing on the validity of the issue today.  Maybe no-one tried the particular action before?

                                           

                                          I have been using DW nearly as long as you, have a first-class degree in computing, and have been programming since 1973.  I haven't seen this before, either -  almost certainly because I haven't tried this particular action until now. In future, if ever the need arises again, I'll know to insert such a region with something between it and the </head> tag so no real harm is done, but the fact remains that there's an anomaly here.

                                           

                                          I'm using DW CS5 - 11.0 build 4993 as part of the Master Collection - running under Win 7 Pro fully updated in 24GB RAM with a i7 processor.  Here are the detailed actions to reproduce the anomaly on my system:

                                           

                                          1. File - New.

                                           

                                          2. Blank Template - HTML template - <none>.  As an example.  Problem not specific to this choice.

                                           

                                          3. In code window, insert blank line immediately above </head> tag and leave cursor at start of that new blank line. Or just put the cursor immediately before the </head> tag.

                                           

                                          4. Topline Insert - Template Objects - Editable Region.  Or us the CTL-ALT-V shortcut.

                                           

                                          5. Click OK on New Editable Region popup box.

                                           

                                          6. Observe that the new editable region is created in the <body> section, not just above the </head> tag where it should have gone.

                                           

                                          I've also just tried exactly the same actions using DW CS4 on a different Win XP system with exactly the same erroneous result.  This really smells like a minor bug, so I have submitted a bug report to Adobe.

                                          • 18. Re: DW CS5 modify template head anomaly
                                            MurraySummers CommunityMVP

                                            I wish you had posted this earlier in the thread.  It would have saved us (or perhaps me) lots of angst!

                                             

                                            I can certainly reproduce this error.  In legacy versions of DW, you could not use the UI to insert editable regions in the head of the document.  Somewhere along the line, this got changed, and those options became enabled, as they obviously are now.  However, no matter where in the head region you try to do that insertion, the editable region is ALWAYS moved to just below the <body> tag, obviously reflecting DW's thinking that you cannot do what you just tried to do!

                                             

                                            Apologies - I will report this to the dev team immediately.  The bottom line is this - if you want an editable region in the head of the document, you must insert it manually, not by using the UI.

                                            • 19. Re: DW CS5 modify template head anomaly
                                              akribie Community Member

                                              I did describe how the problem occurred in the initial post, but not in such detail.

                                               

                                              Other than inserting manually, the easiest workaround is to place the insert above anything else except blank code lines before the </head> tag.

                                              • 20. Re: DW CS5 modify template head anomaly
                                                MurraySummers CommunityMVP

                                                I found that it didn't matter where in the head you place the cursor, the editable region is always created below the body tag.  The easiest workaround in that case is to create the region and then move it to where you want it.

                                                 

                                                This is just wrong.  Either the options should not be available when the insertion point is in the head (which is how it used to be) or the operation should produce the expected results.

                                                • 21. Re: DW CS5 modify template head anomaly
                                                  akribie Community Member

                                                  My turn to apologise.  Please ignore #19.  Murray's #20 is correct.  My memory is obviously failing.

                                                  • 22. Re: DW CS5 modify template head anomaly
                                                    fourwhitesocks Community Member

                                                    Akribie,

                                                     

                                                    Can you show me how the code should look when with your 'work around' so that I can make my head an editable region, the way that you made it work?  I've read this a hundred times and would just like to see an example of the code how you were able to make it work??  Pretty Please...

                                                     

                                                    I have a similar issue as I cannot make my head region editable either and am very frustrated.  I'm using DW cs5.5....

                                                    • 23. Re: DW CS5 modify template head anomaly
                                                      akribie Community Member

                                                      The easiest way is to insert the additional script or whatever into the editable region that is in the Head section by default - that designed to accept a page title.

                                                      • 24. Re: DW CS5 modify template head anomaly
                                                        MurraySummers CommunityMVP

                                                        The easiest way is to insert the additional script or whatever into the editable region that is in the Head section by default - that

                                                        designed to accept a page title.

                                                         

                                                        Although that will work, there is normally a second editable region inserted in the head of a template document called "head", i.e.,

                                                         

                                                        <!--TemplateBeginEditable name="head"-->

                                                        <!--TemplateEndEditable-->

                                                         

                                                        It's usually ideal for usages such as those described in this thread.