26 Aug 2016

Java script function for cookie based Implementation

Java script function for cookie based Implementation

 var list = new cookieList("MyItems");
list.clear();
/console.log(list.items());
list.remove(advid.toString());
 if(!list.contain(advid)){
 list.add(advid);
 }

//This is not production quality, its just demo code.
var cookieList = function(cookieName) {
//When the cookie is saved the items will be a comma seperated string
//So we will split the cookie by comma to get the original array
var cookie = $.cookie(cookieName);
//Load the items or a new array if null.
var items = cookie ? cookie.split(/,/) : new Array();

//Return a object that we can use to access the array.
//while hiding direct access to the declared items array
//this is called closures see http://www.jibbering.com/faq/faq_notes/closures.html
return {
    "add": function(val) {
        //Add to the items.
        items.push(val);
        //Save the items to a cookie.
        //EDIT: Modified from linked answer by Nick see
        //      http://stackoverflow.com/questions/3387251/how-to-store-array-in-jquery-cookie
        $.cookie(cookieName, items.join(','));
    },
    /*"remove": function (val) {
        //EDIT: Thx to Assef and luke for remove.
        indx = items.indexOf(val);
        if(indx!=-1) items.splice(indx, 1);
        $.cookie(cookieName, items.join(','));        },*/
"contain": function (val) {
//Check if an item is there.
//alert("Hello");
var index='';
if(index = items.indexOf(val.toString())){
console.log("Found index of Ad is="+index);
}
if(index>-1){
return true;
}else{
return false;
}
},
"remove": function (val) {
//EDIT: Thx to Assef and luke for remove.
/** indexOf not support in IE, and I add the below code **/
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function(obj, start) {
for (var i = (start || 0), j = this.length; i < j; i++) {
if (this[i] === obj) { return i; }
}
return -1;
}
}
var indx = items.indexOf(val);
if(indx!=-1) items.splice(indx, 1);
//if(indx!=-1) alert('lol');
$.cookie(cookieName, items.join(','));
},
    "clear": function() {
        items = null;
        //clear the cookie.
        $.cookie(cookieName, null);
    },
    "items": function() {
        //Get all the items.
        return items;
    }
  }
}

12 Aug 2016

Php 5 Example - ​http://www.phpclasses.org/package/3698-PHP-MySQL-database-access-wrapper.html

Php 5 Example -
​http://www.phpclasses.org/package/3698-PHP-MySQL-database-access-wrapper.html

Isotopes  Example Link  -

http://www.9bitstudios.com/2013/04/jquery-isotope-tutorial/

http://www.9bitstudios.com/demos/blog/jquery-isotope/

2 Aug 2016

Best Datepicker Plugin

Best datepicker plugin download link -   https://github.com/t1m0n/air-datepicker

Second One -  http://keith-wood.name/datepick.html

Third &best one - http://xdsoft.net/jqplugins/datetimepicker/


<code>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="jquery.datetimepicker.css"/>
<style type="text/css">

.custom-date-style {
background-color: red !important;
}

.input{
}
.input-wide{
width: 500px;
}

</style>
</head>
<body>

<h3>DatePicker</h3>
<input type="text" id="datetimepicker2" value="<?php echo date('d/m/Y', strtotime('24-07-2012')); ?>" /><br><br>


<script src="jquery.js"></script>
<script src="jquery.datetimepicker.full.js"></script>

<script type="text/javascript">
//$.datetimepicker.setLocale('en');
$('#datetimepicker2').datetimepicker({
//yearOffset:222,
lang:'en',
timepicker:false,
format:'d/m/Y',
formatDate:'Y/m/d',
minDate:'1950/01/02', // yesterday is minimum date
maxDate:'2050/01/02' // and tommorow is maximum date calendar
});
</script>
</body>
</html>
</code>