I am trying to set a SESSION variable in Fat Free framework from a view.
My code now is:
<set SESSION.regex_save_successful="false" />
That doesn't work, this doesn't work either
<set SESSION.regex_save_successful=false />
Neither does this:
<set @SESSION.regex_save_successful=(")false(") />
If anyone can help me in the right direction I would appreciate it.
Maybe there are some other solutions to my problem: I would like to reset the variable when the view is loaded and the <check>
is executed. It now says after first reroute: Successful saved. Then after every reload it needs to be blank.
The template engine copies the variables into a new environment ("the sandbox") before rendering a template. As result your code is only modifying the copy instead of the SESSION
variable which gets mapped to the global $_SESSION
variable responsible for session management.
Although it's a bad decision to let the template modify session information, here is a possible solution:
{~ Base::instance()->set('SESSION.regex_save_successful', false); ~}