3 Replies Latest reply on Aug 21, 2007 2:50 PM by Newsgroup_User

    templates and PHP includes

    camille23
      Hi there,

      I've inherited a site that is extremely large and is built with DW templates. Much of the code inside the template, after the opening HTML tag and DTD, etc., is in PHP includes. The issue is that sometimes even this code needs to change, and rolling out such changes to the entire site is such a gargantuan task, we hate to do it.

      I'm much more used to using SSI to handle standard code for a site, so my instinct is to take everything above the editable area in the DW template and plop it into a PHP file called header. And everything after the editable region into a PHP file called footer. Then just include the files before and after the editable region in the template. Thus when we need to make any changes to the template, it happens inside the PHP, and there is no need to update all gazillion pages that use the template.

      I've started playing with this, and so far, DW doesn't seem to like it a whole lot. I get the error that the "first tag is inside editable region" when I save the template. Also, have gotten that message that I've made changes outside the html tag and that I need to put in <!-- TemplateInfo codeOutsideHTMLIsLocked="false" --> or something like that.

      Anyone know whether I can do what I want to do here--basically have absolutely nothing inside the template but one header include, an editable area, and a footer include. No html tag, no other tags.

      Seems much easier to maintain.

      (And if you're going to ask why I'm using DW templates at all, it's because the site uses Contribute for the content contributors, so I assume we have to have templates to tell Contribute what they can edit and can't.)

      Thanks!
        • 1. Re: templates and PHP includes
          Level 7
          > I've inherited a site that is extremely large and is built with DW
          > templates.
          > Much of the code inside the template, after the opening HTML tag and DTD,
          > etc.,
          > is in PHP includes.

          If the information is in includes, it's a simple matter to update, no? By
          using includes, you completely bypass the Template functionality.

          So - I'm a little confused by the rest of the post - can you help?

          --
          Murray --- ICQ 71997575
          Adobe Community Expert
          (If you *MUST* email me, don't LAUGH when you do so!)
          ==================
          http://www.dreamweavermx-templates.com - Template Triage!
          http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
          http://www.dwfaq.com - DW FAQs, Tutorials & Resources
          http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
          ==================


          "camille23" <webforumsuser@macromedia.com> wrote in message
          news:faf29u$69f$1@forums.macromedia.com...
          > Hi there,
          >
          > I've inherited a site that is extremely large and is built with DW
          > templates.
          > Much of the code inside the template, after the opening HTML tag and DTD,
          > etc.,
          > is in PHP includes. The issue is that sometimes even this code needs to
          > change,
          > and rolling out such changes to the entire site is such a gargantuan task,
          > we
          > hate to do it.
          >
          > I'm much more used to using SSI to handle standard code for a site, so my
          > instinct is to take everything above the editable area in the DW template
          > and
          > plop it into a PHP file called header. And everything after the editable
          > region
          > into a PHP file called footer. Then just include the files before and
          > after the
          > editable region in the template. Thus when we need to make any changes to
          > the
          > template, it happens inside the PHP, and there is no need to update all
          > gazillion pages that use the template.
          >
          > I've started playing with this, and so far, DW doesn't seem to like it a
          > whole
          > lot. I get the error that the "first tag is inside editable region" when I
          > save
          > the template. Also, have gotten that message that I've made changes
          > outside the
          > html tag and that I need to put in <!-- TemplateInfo
          > codeOutsideHTMLIsLocked="false" --> or something like that.
          >
          > Anyone know whether I can do what I want to do here--basically have
          > absolutely
          > nothing inside the template but one header include, an editable area, and
          > a
          > footer include. No html tag, no other tags.
          >
          > Seems much easier to maintain.
          >
          > (And if you're going to ask why I'm using DW templates at all, it's
          > because
          > the site uses Contribute for the content contributors, so I assume we have
          > to
          > have templates to tell Contribute what they can edit and can't.)
          >
          > Thanks!
          >


          • 2. Re: templates and PHP includes
            camille23 Level 1
            Hi, thanks for your response.

            Not all the code is in includes, and I would like all of it to be.

            Dreamweaver seems to want some kind of html tag before the first editable area to be actually within the template. When I put everything in the include, I got errors.

            Trying to split up the document the way one normally might if it were all php...like all the opening tags and header stuff in a header, then the content area, then another include for all the closing stuff, is complicated by the presence of the editable areas. They have to be in the template it seems, and not in an include. If you have any editable areas in your head, which we do (so we can manipulate page variables within each page), it makes it pretty difficult to pick around those and extract out code from the template that you can put in includes.

            Not sure if this is really a question anymore...I seem to have determined what you can and can't put in an include when you're using DW templates. If anyone knows different, please let me know!

            Thanks!
            • 3. Re: templates and PHP includes
              Level 7
              DW will not like it if you try to put <html>, <head>, or <body> tags into
              include files. Other than that, you are pretty safe....

              --
              Murray --- ICQ 71997575
              Adobe Community Expert
              (If you *MUST* email me, don't LAUGH when you do so!)
              ==================
              http://www.dreamweavermx-templates.com - Template Triage!
              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
              http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
              ==================


              "camille23" <webforumsuser@macromedia.com> wrote in message
              news:fafm67$sp2$1@forums.macromedia.com...
              > Hi, thanks for your response.
              >
              > Not all the code is in includes, and I would like all of it to be.
              >
              > Dreamweaver seems to want some kind of html tag before the first editable
              > area
              > to be actually within the template. When I put everything in the include,
              > I got
              > errors.
              >
              > Trying to split up the document the way one normally might if it were all
              > php...like all the opening tags and header stuff in a header, then the
              > content
              > area, then another include for all the closing stuff, is complicated by
              > the
              > presence of the editable areas. They have to be in the template it seems,
              > and
              > not in an include. If you have any editable areas in your head, which we
              > do (so
              > we can manipulate page variables within each page), it makes it pretty
              > difficult to pick around those and extract out code from the template that
              > you
              > can put in includes.
              >
              > Not sure if this is really a question anymore...I seem to have determined
              > what
              > you can and can't put in an include when you're using DW templates. If
              > anyone
              > knows different, please let me know!
              >
              > Thanks!
              >
              >