Working with Frontend Session Data


/ Published in: PHP
Save to your folder(s)

This allows any data to be temporarily saved in a user session (for both anonymous visitors and frontend users). The data is temporary though and will be destroyed once the user's cookie has expired.


Copy this code and paste it in your HTML
  1. /* Save preference to user session */
  2. $GLOBALS["TSFE"]->fe_user->setKey("ses","tx_cfcampus_api", $campusUID);
  3. $GLOBALS["TSFE"]->fe_user->sesData_change = true;
  4. $GLOBALS["TSFE"]->fe_user->storeSessionData();
  5.  
  6. /* Retrieve preference from user session */
  7. $campusUID = $GLOBALS["TSFE"]->fe_user->getKey("ses","tx_cfcampus_api");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.