7 Replies Latest reply: Aug 28, 2012 8:30 AM by MurraySummers RSS

    Weird behaviour with image paths

    AspiringDIV Community Member

      Morning all,

       

      I have some strange behaviour going on with my image paths, and wondered if anyone might be able to spot what they think is going on?

       

      On my template relative paths (../Images/example.jpg) work just fine.

       

      However, on child pages the same relative paths  are not showing the images and so I've had to remove the '.../' to get them to work (ending up with Images/example.jpg).

       

      This obviously isn't desirable as I'm manually having to tweak child pages where editable region content has been copied directly from the template which works just fine.

       

      Any ideas what might be up?

       

      Thanks in advance

        • 1. Re: Weird behaviour with image paths
          MurraySummers ACP/MVPs

          So in the template you have links that are NOT being managed by DW when you spawn child pages?  In other words, the template would have a link -

           

          <img src="../path_to_image.jpg"

           

          and when you spawn a child from that template and save the new child at the root level, the child has that same link -

           

          <img src="../path_to_image.jpg"

          ??

          • 2. Re: Weird behaviour with image paths
            AspiringDIV Community Member

            After reading your post I've just tried going through the motions again with a new child page, and that picked up the template image links and hyperlinks as hoped.

             

            It looks like I'd copied and pasted some content from the editable region in my template over to child pages, which caused the issue. Instead, what I've now done is forced the template to update the editable regions from scratch, and then edited my child pages from there to remove content not rquired (I basically have a sidebar of links which are not all relevant to all pages).

             

            Anyway, that's done the trick and it was clearly my poor workflow that was to blame.

             

            Thanks Murray!

            • 3. Re: Weird behaviour with image paths
              MurraySummers ACP/MVPs

              You would never want to do that with templates (copy content from template to child).  Notwithstanding that, though, I don't understand why you would ever want to do that.  When you create a child from a template, the resulting page has all of the content that is on the template, including the content in the editable regions.  Is it that you CHANGED the template by adding content with links to an editable region after creating some child pages?  If that is the case, the best way to handle that would be to either APPLY the template to the legacy pages, or to spawn new child pages, and copy/paste existing content into the new pages before saving the new pages with the same filenames as the legacy pages.

              • 4. Re: Weird behaviour with image paths
                AspiringDIV Community Member

                Thanks Murray, and I think I understand what you mean.

                 

                What I'm a bit confused by, though, is when I setup my new template in DW - including editable regions with some universal content - this all appeared in my child pages, but when I wanted to update some universal content in the editable regions of my template, this was overridden by the content already in the child pages.

                 

                And that's where I started to go wrong!

                • 5. Re: Weird behaviour with image paths
                  MurraySummers ACP/MVPs

                  You have not yet grasped the prime directive of templates, which is that only changes to non-editable regions in the template will propagate to child pages.  If this were not true, then one could never put unique content on a child page!

                   

                  So - the scheme is this:

                   

                  1.  Create a template and save it.

                  2.  Spawn a child page from the template.  The child page will be an 'identical' copy of the template.

                  3.  Add unique content to the child page.  The child page is now no longer an 'identical' copy of the template.

                  4.  Change something in the NON-EDITABLE portion of the template and save it - all child pages receive the change.

                  5.  Change something in the EDITABLE portion of the template and save it - no child pages receive the change.

                  6.  Spawn a NEW page from the template, and it is again an 'identical' copy of the NEW CHANGED template.

                   

                  See how this works?

                  • 6. Re: Weird behaviour with image paths
                    AspiringDIV Community Member

                    Thanks Murray - you were spot-on as ever!

                     

                    I was trying a shortcut which wasn't good practice at all, but reverting to the above sequence has worked perfectly.

                    • 7. Re: Weird behaviour with image paths
                      MurraySummers ACP/MVPs

                      Excellent - good luck!