/
set_session

set_session

The set_session tag allows will store some values in the web session. This allows a website to 'remember' values across multiple pages and requests. This can for example be used to assemble a list of products, and then submit these via one form.

Variables set using these tag, can be retrieved using the session object

It accepts two (unnamed) arguments:

The variable name

  • A string containing only alphanumeric characters and underscores

The variable value

  • A string or number, at most 5000 characters long.

  • Be aware that numbers are converted to strings

Example

The following code sets the session variable 'first_name' to have the value 'Plate'.

{% set_session "first_name", "Plate" %}

After this, {{ session.first_name }} will output Plate

Related content

session
session
More like this
form_input_name
form_input_name
More like this
search_form
search_form
More like this
Objects
Objects
More like this
authenticate
authenticate
More like this
dump_variable
dump_variable
More like this