BoltWire

Cookies

Docs > Extensions > Plugins > Cookies

This plugin adds a bit more cookie functionality to BoltWire. To enable this plugin, add this line to site.config

enableCookies

Basically it adds a getcookie command and function, taking the parameter of the cookie name and returning it's value if it is set. This is similar to the {?var} markup, but it ONLY returns cookies, whereas the built in markup looks for data in various places to try and supply the requested information.

It also adds a setcookie command and function, taking the cookie name and value as parameters and an optional expires parameter (a future timestamp or English equivalent). By default, cookies are set to expire after 1 month. To delete a cookie, set the expires value to 'yesterday' or some other point in the past.

Here's a few examples of how it looks in action:

[command setcookie mycookie myvalue expires='+ 2 weeks']
[command getcookie mycookie]

[(setcookie mycookie myvalue expires='+1 day')]
[(getcookie mycookie)]