For more information... RTFM!

You are not logged in

Powered by Interchange version 5.7.0



  • [set-cookie name value expire domain path]

Parameter Description Default
name The name of the cookie you want to set. None
value Cookie content. None
expire Cookie expiration date. None
domain Override the CookieDomain domain(s). See CookieDomain
path URI path(s) for the cookie. See Catalog


Tag usage example

[set-cookie name="mycookie" value="Cookie Value" expire="Wed, 27-Jun-2007 18:13:00 GMT"]

Perl example

    name => $name,
    value => $value,
    expire => $expire,
    domain => $domain,
    path => $path,

or similarly with positional parameters:

$Tag->set_cookie($name, $value, $expire, $domain, $path);


This 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.



Do not use this tag to attempt to override the "MV_SESSION_ID" cookie.



This is the name of the cookie.  The same name must be used when reading the cookie later, with [read-cookie], or whatever.


The specified value will be stored in the named cookie.


Session 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/time

You may specify any future date/time using the following format:



The timezone must be GMT.  The British invented time - accept it and move on.  :-)

Relative date/time offset

You 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:

    value="the value"
    expire="[time adjust="+2160" gmt=1]%a, %m-%b-%Y %H:%M:%S GMT[/time]"

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.


The (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.


The (space separated) value(s) you specify, using this parameter, will override the default URI path(s) configured using the Catalog global configuration directive.

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Friday 16 July 2010 at 2:05 PM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us