Icontem

Local Data: Store multiple values in single cookies

Recommend this page to a friend!
  Info   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2012-07-03 (3 years ago) RSS 2.0 feedNot enough user ratingsTotal: 214 All time: 206 This week: 58Up
Version License JavaScript version Categories
local-data 1.0Artistic License1.0Browser, jQuery
Description Author

This object can store multiple values in a single cookie.

It can set, get and delete different key values that can be encode to be stored in a single browser cookie.

The original values of the keys are preserved as they are encoded using JSON before storing in the cookies.

Picture of Pavel Kukov
Name: Pavel Kukov <contact>
Classes: 1 package by
Country: Bulgaria Bulgaria
Age: ???
All time rank: 1021 in Bulgaria Bulgaria
Week rank: 65 Up1 in Bulgaria Bulgaria Equal

Details
Sample usage for localdata.js 
=============

* Store - $.localdata("name", "value"); 
value can be integer, string, object, array 
$.localdata("name", [1,2,3,4,5]); 
$.localdata("name", {name: "John Dow", email: "john@company.com"}); 
 
* Read - $.localdata("name"); 
* Delete One Item By Key - $.localdata.remove("name"); or $.localdata("name",null,{expires:-1}); 
* Delete entire cookie - $.localdata.clear(); 
* Count Stored Items - $.localdata.count(); 
* Force Reload - $.localdata.reload(); 
* Get/Set cookie configuration - $.localdata.config() and $.localdata.config({expires: 'in days', path: 'your new path', domain: 'domain', 'secure': true or false}) defaults are expires: 365, path: '/', domain: '', 'secure': '' 
* Get/Set cookie prefix - $.localdata.prefix() and $.localdata.prefix("new_prefix_") default is "localdata_cookie_" 
 
PHP: Sample usage for localdata.php 
=============

* Include - include('localdata.php');  
* Create Object - $localdata = localdata::get();  
 
* Store - $localdata("name", "value"); or $localdata->name = "value"; 
 value can be integer, string, object, array  
$localdata("name", array(1,2,3,4,5));  
$localdata("name", array("name" => "John Dow", "email" => "john@company.com"));  
 
* Read - $localdata("name"); or $localdata->name 
* Delete One Item By Key - $localdata->remove("name");  
* Delete entire cookie - $localdata->clear();  
* Count Stored Items - $localdata->count(); 
* Get/Set cookie configuration - $localdata->config() and $localdata->config(Array('expires' => 'in days', 'path' => 'your new path', 'domain' => 'domain', 'secure' => true or false}) defaults are 'expires' => 365, 'path' => '/', 'domain' => NULL, 'secure' => NULL 
* Get/Set cookie prefix - $localdata->prefix() and $localdata->prefix("new_prefix_") default is "localdata_cookie_"  
  Files folder image Files  
File Role Description
Files folder imagejs (2 files)
Accessible without login Plain text file index.html Doc. index.html
Accessible without login Plain text file index.php Doc. index.php
Accessible without login Plain text file localdata.php Data localdata.php
Accessible without login Plain text file README Doc. README

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file jquery-1.7.2.min.js Aux. jquery-1.7.2.min.js
  Plain text file localdata.js Class localdata.js

 Version Control Unique User Downloads Download Rankings  
 0%
Total:214
This week:0
All time:206
This week:58Up