2 Replies Latest reply on Apr 6, 2009 11:46 AM by DwFAQ

    Show Logout or Login / Register Links

    xriokax Level 1

      Hello

       

      I want to show either "Logout" or "Login / Register" depending on if the user is logged in or logged out.

       

      I can do this no problem on individual pages but I now have a templted site with LOTS of pages. I dont want to add this login manually to every page so would dearly love to add it to my template and for it to populate through all the pages but of course I run into the old template problem as ADDT starts adding stuff...

       

      // Load the tNG classes
      require_once('includes/tng/tNG.inc.php');

       

      ...outside the HTML which then breaks all my pages that already have dynamic content added.

       

      Any ideas on a work around?

       

      Thanks so much in advance!!!

       

      Paul

        • 1. Re: Show Logout or Login / Register Links
          Günter Schenk Level 4

          Hi Paul,

           

          I suggest to try implementing a basic PHP if/else statement which checks if the Session Variable "kt_login_id" is set or not, example:

           

          <?php
          if (isset($_SESSION['kt_login_id'])) {
          ?>
          show logout link
          <?php
          } else { ?>
          show login link
          <?php }
          ?>

           

           

          Cheers,

          Günter Schenk

          Adobe Community Expert, Dreamweaver

          1 person found this helpful
          • 2. Re: Show Logout or Login / Register Links
            DwFAQ Level 4

            Heya Paul,

             

            If you do simple conditional region as suggested make sure you have a session started in the page to check if session kt_login_id is present. If I'm not mistaken this is basically what you're trying to avoid but nonetheless you have to start a session in order to check session variables

            1 person found this helpful