Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Sessions


Go to End


2 Posts   1739 Views

Avatar
Hankins

Community Member, 11 Posts

1 December 2009 at 7:34am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

1 December 2009 at 7:41pm

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.