8 Replies Latest reply on Nov 17, 2008 3:46 AM by Newsgroup_User

    PHP with templates in cs3

    malcster2 Level 1
      hello

      i am trying to put some PHP code in a template.

      the problem is, although the child pages recognize the php code, the templates don't. i.e, the code doesn't turn red, and debugging is giving me a bit of a headache.

      is there a setting to turn on so templates can recognize the php?
        • 1. Re: PHP with templates in cs3
          Level 7
          malcster2 wrote:
          > is there a setting to turn on so templates can recognize the php?

          You need to make the template from a PHP page. PHP templates have
          .dwt.php as the filename extension, instead of just .dwt.

          --
          David Powers, Adobe Community Expert
          Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
          Author, "PHP Solutions" (friends of ED)
          http://foundationphp.com/
          • 2. Re: PHP with templates in cs3
            malcster2 Level 1
            hhhmmmm, thats what i thought. not that keen on recreating a new template, as have quite a few pages linked to my original. have fixed the bug anyway.

            whilst your on the phone.....

            i have a login set up for my clients on my site. it is accessible on all pages.

            my question is, once a client has logged in, is there a safe way to keep the user logged in across all pages, without using cookies?

            thanks
            • 4. Re: PHP with templates in cs3
              Level 7
              > hhhmmmm, thats what i thought. not that keen on recreating a new template

              Just rename your existing template from foo.dwt to foo.dwt.php.

              > my question is, once a client has logged in, is there a safe way to keep
              > the
              > user logged in across all pages, without using cookies?

              When the user is logged in, session variables are set. Any page in the site
              can then test for the existence of those session variables to check whether
              the current user is logged in. The session variables will last as long as
              the current session is in play. Is that your question?

              --
              Murray --- ICQ 71997575
              Adobe Community Expert
              (If you *MUST* email me, don't LAUGH when you do so!)
              ==================
              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
              ==================


              "malcster2" <webforumsuser@macromedia.com> wrote in message
              news:gfp646$pab$1@forums.macromedia.com...
              , as
              > have quite a few pages linked to my original. have fixed the bug anyway.
              >
              > whilst your on the phone.....
              >
              > i have a login set up for my clients on my site. it is accessible on all
              > pages.
              >
              > my question is, once a client has logged in, is there a safe way to keep
              > the
              > user logged in across all pages, without using cookies?
              >
              > thanks
              >
              >

              • 5. Re: PHP with templates in cs3
                Level 7
                Rename IN DW!

                --
                Murray --- ICQ 71997575
                Adobe Community Expert
                (If you *MUST* email me, don't LAUGH when you do so!)
                ==================
                http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                ==================


                "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                news:gfp6u9$q7u$1@forums.macromedia.com...
                >> hhhmmmm, thats what i thought. not that keen on recreating a new template
                >
                > Just rename your existing template from foo.dwt to foo.dwt.php.
                >
                >> my question is, once a client has logged in, is there a safe way to keep
                >> the
                >> user logged in across all pages, without using cookies?
                >
                > When the user is logged in, session variables are set. Any page in the
                > site can then test for the existence of those session variables to check
                > whether the current user is logged in. The session variables will last as
                > long as the current session is in play. Is that your question?
                >
                > --
                > Murray --- ICQ 71997575
                > Adobe Community Expert
                > (If you *MUST* email me, don't LAUGH when you do so!)
                > ==================
                > http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                > http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                > ==================
                >
                >
                > "malcster2" <webforumsuser@macromedia.com> wrote in message
                > news:gfp646$pab$1@forums.macromedia.com...
                > , as
                >> have quite a few pages linked to my original. have fixed the bug anyway.
                >>
                >> whilst your on the phone.....
                >>
                >> i have a login set up for my clients on my site. it is accessible on all
                >> pages.
                >>
                >> my question is, once a client has logged in, is there a safe way to keep
                >> the
                >> user logged in across all pages, without using cookies?
                >>
                >> thanks
                >>
                >>
                >

                • 6. Re: PHP with templates in cs3
                  malcster2 Level 1
                  thanks murray that has answered my question, i was thinking it a bit more complicated then it actually is. i am however, getting an error with this piece of code:

                  <div id="logintext">
                  <?php

                  if($count==1)
                  {
                  session_start();

                  $_SESSION['sesdomain'] = $_POST['Domain'];

                  echo "welcolm $_SESSION['sesdomain'] ";
                  }
                  else
                  {
                  echo "invalid username/password";
                  }

                  ?>

                  </div>


                  the error is Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /customers/bwise-webdevelopment.co.uk/bwise-webdevelopment.co.uk/httpd.www/index2.php on line 73

                  any ideas?
                  • 7. Re: PHP with templates in cs3
                    Level 7
                    Try this:

                    <div id="logintext">
                    <?php
                    if($count==1)
                    {
                    session_start();
                    $_SESSION['sesdomain'] = $_POST['Domain'];
                    echo "welcolme " . $_SESSION['sesdomain'];
                    }
                    else
                    {
                    echo "invalid username/password";
                    }
                    ?>
                    </div>


                    --
                    Ken Ford
                    Fordwebs, LLC
                    Adobe Community Expert - Dreamweaver/ColdFusion
                    Adobe Certified Expert - Dreamweaver CS3
                    Adobe Certified Expert - ColdFusion 8
                    http://www.fordwebs.com
                    http://www.cfnoob.com


                    "malcster2" <webforumsuser@macromedia.com> wrote in message news:gfpe82$5uj$1@forums.macromedia.com...
                    > thanks murray that has answered my question, i was thinking it a bit more
                    > complicated then it actually is. i am however, getting an error with this piece
                    > of code:
                    >
                    > <div id="logintext">
                    > <?php
                    >
                    > if($count==1)
                    > {
                    > session_start();
                    >
                    > $_SESSION['sesdomain'] = $_POST['Domain'];
                    >
                    > echo "welcolm $_SESSION['sesdomain'] ";
                    > }
                    > else
                    > {
                    > echo "invalid username/password";
                    > }
                    >
                    > ?>
                    >
                    > </div>
                    >
                    >
                    > the error is Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
                    > expecting T_STRING or T_VARIABLE or T_NUM_STRING in
                    > /customers/bwise-webdevelopment.co.uk/bwise-webdevelopment.co.uk/httpd.www/index
                    > 2.php on line 73
                    >
                    > any ideas?
                    >
                    • 8. Re: PHP with templates in cs3
                      Level 7
                      Or this -

                      <div id="logintext">
                      <?php
                      if($count==1)
                      {
                      session_start();
                      $_SESSION['sesdomain'] = $_POST['Domain'];
                      echo "welcome " . $_SESSION['sesdomain'];
                      }
                      else
                      {
                      echo "invalid username/password";
                      }
                      ?>
                      </div>

                      8)

                      --
                      Murray --- ICQ 71997575
                      Adobe Community Expert
                      (If you *MUST* email me, don't LAUGH when you do so!)
                      ==================
                      http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                      http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                      ==================


                      "Ken Ford - *ACE*" <newsgroups2@fordwebs.com> wrote in message
                      news:gfpfsb$7pp$1@forums.macromedia.com...
                      > Try this:
                      >
                      > <div id="logintext">
                      > <?php
                      > if($count==1)
                      > {
                      > session_start();
                      > $_SESSION['sesdomain'] = $_POST['Domain'];
                      > echo "welcolme " . $_SESSION['sesdomain'];
                      > }
                      > else
                      > {
                      > echo "invalid username/password";
                      > }
                      > ?>
                      > </div>
                      >
                      >
                      > --
                      > Ken Ford
                      > Fordwebs, LLC
                      > Adobe Community Expert - Dreamweaver/ColdFusion
                      > Adobe Certified Expert - Dreamweaver CS3
                      > Adobe Certified Expert - ColdFusion 8
                      > http://www.fordwebs.com
                      > http://www.cfnoob.com
                      >
                      >
                      > "malcster2" <webforumsuser@macromedia.com> wrote in message
                      > news:gfpe82$5uj$1@forums.macromedia.com...
                      >> thanks murray that has answered my question, i was thinking it a bit more
                      >> complicated then it actually is. i am however, getting an error with this
                      >> piece of code:
                      >>
                      >> <div id="logintext">
                      >> <?php
                      >>
                      >> if($count==1)
                      >> {
                      >> session_start();
                      >> $_SESSION['sesdomain'] = $_POST['Domain'];
                      >> echo "welcolm $_SESSION['sesdomain'] ";
                      >> }
                      >> else
                      >> {
                      >> echo "invalid username/password";
                      >> }
                      >>
                      >> ?>
                      >> </div>
                      >>
                      >>
                      >> the error is Parse error: syntax error, unexpected
                      >> T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or
                      >> T_NUM_STRING in
                      >> /customers/bwise-webdevelopment.co.uk/bwise-webdevelopment.co.uk/httpd.www/index
                      >> 2.php on line 73
                      >>
                      >> any ideas?
                      >>