Posts

Input field for search

For hidding while OnFocus Search input field, we can use simple Javascript inside the field, <input type="text" name="s" id="searchinput" value="Search here ..." onblur="if (this.value == '') {this.value = 'Search here ...';}" onfocus="if (this.value == 'Search here ...') {this.value = '';}">

Solution for getting error in less than IE9 does not support querySelectorAll

You have to include the below lines, Quirks mode: this is usually triggered by a missing or broken Doctype. If this is the case, make sure your page starts with the following: <!DOCTYPE html> Compatibility mode (IE7 mode): This may be triggered if you're viewing the page locally (ie running it on your local machine, eg for testing, or on your local network). In this case, you are being hit by an IE config setting that you should disable. Go to the Tools menu, and pick the Comaptibility View Settings option. Untick the compatibility options, and the page should start working. Compat mode may also be triggered (or avoided) by an X-UA-Compatibility meta tag. If you're having trouble with compatibility mode, this is a good way to avoid it: Add the following line to your code: <meta http-equiv="X-UA-Compatible" content="IE=edge">  Src: http://stackoverflow.com/questions/16920365/ie8-does-not-support-queryselectorall

Accurate time using PHP

<?php     function ezDate($d) {         $ts = time() - strtotime(str_replace("-","/",$d));                 if($ts>31536000) $val = round($ts/31536000,0).' year';         else if($ts>2419200) $val = round($ts/2419200,0).' month';         else if($ts>604800) $val = round($ts/604800,0).' week';         else if($ts>86400) $val = round($ts/86400,0).' day';         else if($ts>3600) $val = round($ts/3600,0).' hour';         else if($ts>60) $val = round($ts/60,0).' minute';         else $val = $ts.' second';                 if($val>1) $val .= 's';   ...

Date/Time in PHP

<?PHP      //Current Year     $year = date("Y");      //2013         //Current Month     $month = date("m");    //08         //Current day     $day = date("d");     //12         //Tomorrow's day     $day = date("d")+1;    //13             //TODAY'S DATE          $start =  date("Y-m-d");     //2013-08-12               //1 MONTH FROM TODAY          $end = date("Y-m-d",strtotime("+1 months"));     //2013-09-12          //5 DAYS FROM TODAY         $reminder = date("Y-m-d",strtotime("+5...

Birthdate validation for less than 18 in PHP

Here is the code to validate for birthdate, //Validate for users below 18 only function birthdate($then, $min) {   // $then will first be a string-date   $then = strtotime($then);   //The age to be less than 18   $min = strtotime('+18 years', $then);    if(time() < $min)   {      return false;   }   else {      return true;   } }

ul li for 4 partition

Code:    {assign var="productByLine" value = "4"}    {assign var="productLineTurn" value = "1"}    {assign var="tr" value = "true"}    {assign var="turns" value = "1"}        <table style="border: 1px solid #CCC;">       {foreach from=$upcomingEvent item=product name=products}                    <!-- Start a new line -->          {if $tr eq "true"}             <tr>             {assign var="productLineTurn" value = "1"}             {assign var="tr" value = "false"}          {/if}              ...

Facebook - Sharing with site image, title and description

Facebook crawls the page to decide how to display it. In order to specify the share to look according to your liking, you will have to add open graph tags . Below is the example: <meta property="og:image" content="URL OF IMAGE" /> <meta property="og:title" content="TITLE TO APPEAR" /> in the header of each page of your site. You can know about it from here: http://support.sharethis.com/customer/portal/articles/475079-share-properties-and-sharing-custom-information#Open_Graph_Tags Please remove the "st" properties from the span tag code, the span tag should look like - Hello User, <span class='st_facebook_large' ></span>