CookieMonster 0.1.0-rc1

CookieMonster 0.1.0-rc1

Released Jan 18, 2010 by
CookieMonster is a snippet that allows users to interact with cookies. It uses a simple form to set a cookie and then displays custom messages on pages if the designated cookie is set. CookieMonster can also interact with cookies that have already been set by other scripts or applications so you are not dependant on setting the cookie with CookieMonster if you don't want to. Download 5kb (299 downloads)
1 Likes, 0 Dislikes
Report this Extra
Downloads: 299
License: GPLv2
Discuss Extra
Requires Evolution 1.0.x or greater
Supports mysql
CookieMonster is a simple snippet that allows users to interact with cookies. Its primary function is to display a custom chunk if a designated cookie has been set. It can be used to set new cookies or it can be used to interact with cookies that already exist. A cookie that already exists could be a cookie already set by CookieMonster on a previous page or it could be a cookie set by another script/application e.g. jquery. The required parameter is &cookie_name. This parameter can be one of two things: 1. It can be the name of the cookie you wish to interact with if a cookie is already set. 2. It can be the name of a cookie you want to set if you are using CookieMonster to set a cookie. Optional parameters include: &message, &noSet, &redirect, &setCookieTpl. The definitions of these parameters and their possible values, as well as example calls can be found in the comments at the top of the CookieMonster.txt file.

Installation Instructions

1. Create a new snippet called CookieMonster and paste the contents of CookieMonster.txt into it.

2. Call the snippet where you wish to interact with a cookie.

Examples:

[!CookieMonster? &cookie_name=`yourCookieName` &message=`yourMessage` !]

The above call sets a cookie called "yourCookieName" and displays a custom message in a chunk called "yourMessage" after the cookie is set. It will use the default template for setting cookies and will "redirect" to the current page after the form is submitted.

[!CookieMonster? &cookie_name=`yourCookieName` &message=`yourMessage` &noSet=`1` !]

The above call does not set a cookie. Instead, it displays a custom message in a chunk called "yourMessage" if the "yourCookieName" cookie has been set. This is most useful if you have already set a cookie on another page and only want to display a custom message or if you are interacting with a cookie that already exists. In either case the cookie could have been set previously by CookieMonster or it could have been set by a different snippet or script.

Note: If you wish to use your own custom form to set a cookie, you can put it in a custom chunk and call it by using &setCookieTpl parameter. Look at the setCookieTpl_example.txt file to see a simple example. You can use the [+CookieMonsterName+] placeholder in your custom template.

For more examples look at the comments at the top of the CookieMonster.txt file.