Jump to:

23478 Posts in 18950 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Sessions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 977 Views
  • Hankins
    Community Member
    11 Posts

    Sessions Link to this post

    Can someone please provide me with documentation or an example of creating/managing session variables in SS. Where do I set session variables and where/how do I check if these variables are present. I am trying to set & check for a variable after a certain page has been navigated to. For example, if I select a store as my location, I would like to remember this as the user navigates the site.Thanks for any help.

  • Willr
    Forum Moderator
    5502 Posts

    Re: Sessions Link to this post

    Session::set('var', "true!"); // sets var to "true!"
    Session::get('var'); // returns "true!"
    Session::clear('var'); // empties var

    You can call those in any of your PHP files, classes.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.