10 Replies Latest reply on Aug 3, 2006 1:32 PM by Newsgroup_User

    Templates, paths and php

    jacy77
      I have the following 2 lines in a non-editable region of a template:

      <link href="../main.css" rel="stylesheet" type="text/css" />
      <?php $CSS=1; require("../calendar/calendar.php"); ?>

      The first rewrites properly in documents no matter where they are ultimately saved in the site structure.

      The second does not. Is there a way to write that line so that DW can modify the path as needed?

      Thanks,
      ~Jacy
        • 1. Re: Templates, paths and php
          Level 7
          No. At least not currently.

          Why not make it a root relative link? Then the problem goes away, no?

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


          "jacy77" <webforumsuser@macromedia.com> wrote in message
          news:ear40f$577$1@forums.macromedia.com...
          >I have the following 2 lines in a non-editable region of a template:
          >
          > <link href="../main.css" rel="stylesheet" type="text/css" />
          > <?php $CSS=1; require("../calendar/calendar.php"); ?>
          >
          > The first rewrites properly in documents no matter where they are
          > ultimately
          > saved in the site structure.
          >
          > The second does not. Is there a way to write that line so that DW can
          > modify
          > the path as needed?
          >
          > Thanks,
          > ~Jacy
          >
          >


          • 2. Re: Templates, paths and php
            Level 7
            I'm having a horrible problem in my root relative links with my host. As
            soon as I make the link root relative, it fails (in included files). :(

            Still haven't found a workaround, I'm betting I'll need to actually grab
            file locations.

            Anyway, I've got a very similar problem, which is keeping me back from
            templates right now.

            Jon

            "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
            news:ear4k9$5um$1@forums.macromedia.com...
            > No. At least not currently.
            >
            > Why not make it a root relative link? Then the problem goes away, no?
            >
            > --
            > 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
            > ==================
            >
            >
            > "jacy77" <webforumsuser@macromedia.com> wrote in message
            > news:ear40f$577$1@forums.macromedia.com...
            >>I have the following 2 lines in a non-editable region of a template:
            >>
            >> <link href="../main.css" rel="stylesheet" type="text/css" />
            >> <?php $CSS=1; require("../calendar/calendar.php"); ?>
            >>
            >> The first rewrites properly in documents no matter where they are
            >> ultimately
            >> saved in the site structure.
            >>
            >> The second does not. Is there a way to write that line so that DW can
            >> modify
            >> the path as needed?
            >>
            >> Thanks,
            >> ~Jacy
            >>
            >>
            >
            >


            • 3. Re: Templates, paths and php
              Level 7
              Try a simple test, Jon. The only think I can think of is if your site's
              root is not actually the root of the hosting web site.

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


              "crash" <crash@bcdcdigital.com> wrote in message
              news:ear62e$7jm$1@forums.macromedia.com...
              > I'm having a horrible problem in my root relative links with my host. As
              > soon as I make the link root relative, it fails (in included files). :(
              >
              > Still haven't found a workaround, I'm betting I'll need to actually grab
              > file locations.
              >
              > Anyway, I've got a very similar problem, which is keeping me back from
              > templates right now.
              >
              > Jon
              >
              > "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
              > news:ear4k9$5um$1@forums.macromedia.com...
              >> No. At least not currently.
              >>
              >> Why not make it a root relative link? Then the problem goes away, no?
              >>
              >> --
              >> 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
              >> ==================
              >>
              >>
              >> "jacy77" <webforumsuser@macromedia.com> wrote in message
              >> news:ear40f$577$1@forums.macromedia.com...
              >>>I have the following 2 lines in a non-editable region of a template:
              >>>
              >>> <link href="../main.css" rel="stylesheet" type="text/css" />
              >>> <?php $CSS=1; require("../calendar/calendar.php"); ?>
              >>>
              >>> The first rewrites properly in documents no matter where they are
              >>> ultimately
              >>> saved in the site structure.
              >>>
              >>> The second does not. Is there a way to write that line so that DW can
              >>> modify
              >>> the path as needed?
              >>>
              >>> Thanks,
              >>> ~Jacy
              >>>
              >>>
              >>
              >>
              >
              >


              • 4. Re: Templates, paths and php
                Level 7
                Murray *ACE* wrote:
                > Try a simple test, Jon. The only think I can think of is if your site's
                > root is not actually the root of the hosting web site.

                PHP includes require a relative link, not a site root relative one.
                However, you can use the equivalent of site root relative links by using
                $_SERVER['DOCUMENT_ROOT'], and concatenating it with the site-root
                relative link.

                --
                David Powers
                Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                Author, "Foundation PHP 5 for Flash" (friends of ED)
                http://foundationphp.com/
                • 5. Re: Templates, paths and php
                  Level 7
                  Murray *ACE* wrote:
                  > No. At least not currently.
                  >
                  > Why not make it a root relative link? Then the problem goes away, no?

                  No, because PHP doesn't accept root relative links in require.

                  The reason the links aren't being updated is because you have other code
                  in the same PHP block. It's a quirk of Dreamweaver that includes and
                  require commands need to be in a PHP block of their own like this:

                  <?php require("../calendar/calendar.php"); ?>

                  --
                  David Powers
                  Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                  Author, "Foundation PHP 5 for Flash" (friends of ED)
                  http://foundationphp.com/
                  • 6. Re: Templates, paths and php
                    Level 7
                    (that's exactly what it is)

                    I know the problem, jsut dont' know of a good solution yet. And it's about
                    five tiers down on the "I"m worried" scale. :O)

                    I figure after I've for sure got the development of the site locked in, it
                    should be an easy thing to just put in the templates. Most of my content is
                    dyanmic and created by included files, so while it's a massive issues
                    site-wide-wise (?wow), I have the belief it's goign to be a simple one to
                    solve.

                    I will post more about it when I figure it out. I'm hosted on a very common
                    server, so I'm sure it's an issue that's been run into several times before.

                    Jon

                    "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                    news:ear69v$7vo$1@forums.macromedia.com...
                    > Try a simple test, Jon. The only think I can think of is if your site's
                    > root is not actually the root of the hosting web site.
                    >
                    > --
                    > 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
                    > ==================
                    >
                    >
                    > "crash" <crash@bcdcdigital.com> wrote in message
                    > news:ear62e$7jm$1@forums.macromedia.com...
                    >> I'm having a horrible problem in my root relative links with my host. As
                    >> soon as I make the link root relative, it fails (in included files). :(
                    >>
                    >> Still haven't found a workaround, I'm betting I'll need to actually grab
                    >> file locations.
                    >>
                    >> Anyway, I've got a very similar problem, which is keeping me back from
                    >> templates right now.
                    >>
                    >> Jon
                    >>
                    >> "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                    >> news:ear4k9$5um$1@forums.macromedia.com...
                    >>> No. At least not currently.
                    >>>
                    >>> Why not make it a root relative link? Then the problem goes away, no?
                    >>>
                    >>> --
                    >>> 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
                    >>> ==================
                    >>>
                    >>>
                    >>> "jacy77" <webforumsuser@macromedia.com> wrote in message
                    >>> news:ear40f$577$1@forums.macromedia.com...
                    >>>>I have the following 2 lines in a non-editable region of a template:
                    >>>>
                    >>>> <link href="../main.css" rel="stylesheet" type="text/css" />
                    >>>> <?php $CSS=1; require("../calendar/calendar.php"); ?>
                    >>>>
                    >>>> The first rewrites properly in documents no matter where they are
                    >>>> ultimately
                    >>>> saved in the site structure.
                    >>>>
                    >>>> The second does not. Is there a way to write that line so that DW can
                    >>>> modify
                    >>>> the path as needed?
                    >>>>
                    >>>> Thanks,
                    >>>> ~Jacy
                    >>>>
                    >>>>
                    >>>
                    >>>
                    >>
                    >>
                    >
                    >


                    • 7. Re: Templates, paths and php
                      Level 7
                      ;) Thanks David. I was thinking I'd have to do something like that, but had
                      no idea it would be so easy.


                      • 8. Re: Templates, paths and php
                        Level 7
                        Yeah - that's the ticket.

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


                        "crash" <crash@bcdcdigital.com> wrote in message
                        news:ear7s9$9t5$1@forums.macromedia.com...
                        > ;) Thanks David. I was thinking I'd have to do something like that, but
                        > had no idea it would be so easy.
                        >
                        >


                        • 9. Templates, paths and php
                          jacy77 Level 1
                          David,

                          If I understood your response correctly I should format my code thusly:

                          <?php $CSS=1; ?>
                          <?php require("../calendar/calendar.php"); ?>
                          </head>
                          <body>
                          <?php $OL=1; ?>
                          <?php require("../calendar/calendar.php"); ?>

                          The calendar works but DW still does not update the path properly in the template. Did I misunderstand or leave something out?

                          I've also been posting on the board for this particular calendar script and was told by the author that root relative would work for the script so I'd already tried that and no joy. But maybe I need to hit the books on DW templates again because when I used root relative, the template and its children all bombed (links to images, etc., failed) so I stopped right there.

                          ~Jacy
                          • 10. Re: Templates, paths and php
                            Level 7
                            jacy77 wrote:
                            > The calendar works but DW still does not update the path properly in the
                            > template. Did I misunderstand or leave something out?

                            No, you didn't misunderstand. Perhaps it's just a quirk (bug) in DW
                            templates. Certainly, with ordinary pages, you need to have the require
                            in a separate PHP block.

                            Personally, I find Dreamweaver templates a waste of time with dynamic
                            pages. Basically, a dynamic page is a template in itself. It's all I
                            find necessary. Of course, other people have different views and
                            requirements.

                            --
                            David Powers
                            Adobe Community Expert
                            Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                            http://foundationphp.com/