Cookie Plus

Developer

Laisvunas

3rd Party (Free)

4 downloads (last 90 days)


EE Version Support

  • ExpressionEngine 1.x
  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

Tags

Cookie Plus sets and retrieves cookies.

This was written to overcome two main limitations of the original Cookies plugin:

1)  using it you should place the code for setting cookie on top of the page and cookie must be set before any output started
2)  it is not possible to use retrieved cookie as parameter of other tags.

The Cookie Plus plugin has no such restrictions and retains all functionality of Cookies plugin.

USAGE:

{exp:cookie_plus:set name="mycookie" value="hellow!" seconds="3600"}

Sets a cookie named mycookie with the value “hellow!”. The cookie
will last for 1 hour (3600 seconds).
Set the seconds to zero to set a session cookie.

By default cookie is set using PHP function. This means that {exp:cookie_plus:set}
tag must be on top of the page and do its job before any other output. If you need
to set a cookie after output started, you may use parameter “method”.
In case parameter “method” has a value “script” as here

{exp:cookie_plus:set name="mycookie" value="hellow!" seconds="3600" method="script"}

the cookie will be set using client-side javascript.

Using client-side javascript cookie by default will be set during page load event.
Also cookie will be set during page load event if “event” parameter is set to “load”.
To set cookie during page unload event, parameter “event”  should have the value “unload”:

{exp:cookie_plus:set name="mycookie" value="hellow!" seconds="3600" method="script" event="unload"}

To retrieve a cookie:

{exp:cookie_plus:get name="mycookie"}

If the cookie “mycookie” exists then it will return the value.
If the cookie does not exist then it will return nothing.

Alternatively for retrieving a cookie you may use {cookie} variable
placed between {exp:cookie_plus:get} and {/exp:cookie_plus:get}
tag pair.

Variable {cookie} within {exp:cookie_plus:get} and {/exp:cookie_plus:get} tag pair is
more powerful because you can use its output as parameter of other tag. For such use
you must add parse=“inward” parameter to {exp:cookie_plus:get} tag.

For example, code as this will work

{exp:cookie_plus:get name="mycookie" parse="inward"}
{exp:weblog:entries weblog="{cookie}" show="1|3|5"}
Some code
{/exp:weblog:entries}
{/exp:cookie_plus:get}

Also you can use retrieved cookie value in conditionals:

{exp:cookie_plus:get name="mycookie"}
{if  cookie=="news"}
Some code
{/if}
{/exp:cookie_plus:get}

Download Cookie Plus

EE Support Downloads Add-On Version Release Date
Not Specified Download 1.2.1
Not Specified Download 1.2.1

This entry was created June 10, 2009, 10:14 am.
This entry was last updated June 3, 2013, 1:07 pm.

Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

5 Reviews:

Codable 08.06.14

Codable
Rating - {addon_rating_average}

Correction to WT reply:

The set method prefixes cookie name with “exp__” (two underscore, not just one), so if you set with name=“mycookie”, you need to use get with name=“exp__mycookie” for it to work.

WT 09.12.13

WT
Rating - {addon_rating_average}

The docs are a little off but the plugin is fantastic. The things I noticed not mentioned in the docs is the cookie name you set gets prepended with “exp_” so when checking a cookies value you need to prepend “exp_” to the cookies name.

Also when I set a value to “y” it changed the value to “yes”

Akwadnet 05.01.12

Akwadnet
Rating - {addon_rating_average}

it is good as concept, but is has bugs that makes life harder :(
specialty with if statement

northernpacificdigital 07.06.11

northernpacificdigital
Rating - {addon_rating_average}

Not sure if I installed it correctly, since there are no instructions, but when I try to use this plugin, it chokes the other EE tags on the page, and can’t save or retrieve cookies.  Clearly a few other people haven’t had trouble, maybe it’s something with EE2.2, but I got exactly none joy.

Lee 12.14.10

Lee
Rating - {addon_rating_average}

Just wanted to say thanks for the EE2 version. It works very well. I was trying to use http://www.putyourlightson.net/projects/session_variables, but it dosen’t work across MSM sites – so your plugin was a lifesaver.