Use PHP sessions in header?

Discussion in 'Customization & add-ons' started by scott_sm, Aug 28, 2008.

  1. scott_sm

    scott_sm New Member

    Joined:
    Aug 22, 2006
    Messages:
    26
    Before I bug Alex, I figured I'd see if anyone else has done this...

    I would like to include items like "Welcome Frank!" in my amember header, utilizing the amember sessions as shown in the documentation. Basically, I want to display different items in my header based on if the user is logged in or logged out. I've tried initiating PHP sessions in the header.html file but it gives me errors in relation to the "print" commands. Is this possible in the header.html file, or is there any other way to use sessions on the header? Thanks!



    EDIT: OK... I see in this thread that I should be using Smarty variables in my header.html. This does work when the user is logged in. However, what if the user is not logged in? How can I tell the header to display certain "guest" information?
  2. scott_sm

    scott_sm New Member

    Joined:
    Aug 22, 2006
    Messages:
    26
    Figured it out

    Guess I shouldn't have posted so soon. I figured it out:

    Code:
    {if $smarty.session._amember_user.login}
    
    Display information for logged-in member
    
    {else}
    
    Display info for guest
    
    {/if}

Share This Page