![]() |
| > Home > Documentation > Latest documentation > Interchange tags > set-cookie |
|
set-cookieSummary
ExamplesTag usage example
Perl example
or similarly with positional parameters:
DescriptionThis tag sets one or more browser cookies with your specified name, value, expiration date and other parameters, as required. Interchange will set more than one cookie more than one is needed to ensure that the cookie is visible from all Catalog URI path aliases and CookieDomains. If you need access to the cookie from outside of your Interchangewebsite, then you can also set the domain(s) and URI path(s) for which the cookie will be valid. If you need the cookie to be valid only within your Interchange-driven, and the domains specified by the CookieDomain directive, then you should not specify "domain" and "path" values of your own. If there is more than one value in the "domain" or "path" (or the associated defaults, specified using the CookieDomain and Catalog directives), then one cookie will be created for each domain and path value combination. This ensures that the cookie will be visible, regardless of the method the visitor uses to return to your website.
ParametersnameThis is the name of the cookie. The same name must be used when reading the cookie later, with [read-cookie], or whatever. valueThe specified value will be stored in the named cookie. expireSession cookies are only valid during a browser session, and are automatically rendered invalid (usually deleted) as soon as the user closes the browser. Persistent cookies outlive browser sessions, but cannot live forever. If you want your cookie to be persistent then you must specify an expiration date. You may set a persistent cookie's expiration date using either of the following two methods: Absolute date/timeYou may specify any future date/time using the following format:
Relative date/time offsetYou may specify an expiration date/time in terms of an offset from the current date and time. The date must take the form of a number, followed by one of "seconds", "minutes", "hours", "days" or "weeks". For example: "7 days", " 4 weeks" or "60 minutes" etc. You can also use the [time] tag, in conjunction with the [set-cookie], tag to set the expiration date to an absolute or relative date. For example:
The adjustment of "+2160", in the example above, specifies that the cookie's expiration should be "2160 hours" (or "90 days") after the current date. The time format tokens, use in the above example, are listed and explained on this page. domainThe (space separated) value(s) you specify, using this parameter, will override the default domain(s), listed using the CookieDomain local configuration directive. You might want to set this if you need to access the cookie from outside of the Interchange-driven website, but it is usually better to use the CookieDomain directive instead. The default is to use your website's domain or all of the values declared using the CookieDomain local configuration directive. pathThe (space separated) value(s) you specify, using this parameter, will override the default URI path(s) configured using the Catalog global configuration directive.
|
| Home | Legal nonsense | Privacy policy | Contact us |