PHP date convert from dd/mm/YYYY to YYYY-mm-dd

strtotime not work for date format of dd/mm/YYYY. So You can change dd/mm/YYYY to YYYY-mm-dd from code given below.

$startdate = “25/03/2012”;
$dateobj = DateTime::createFromFormat(‘d/m/Y’, $startdate);
$startdateval = $dateobj->format(‘Y-m-d’);


using php to encode characters for mailto function

When We use mailto function then body message and title in Microsoft outlook contain some additional characters like “+” and others. For remove those special characters we have to encode them.We can Use the rawurlencode function to encode the characters like space and others that aren’t valid in URLs.

For eg:
$title_mail = $ref[0]->title;
$sub = mb_convert_encoding($title_mail, ‘UTF-8’, ‘UTF-8’);
$body = rawurlencode($message);
$mail_query = array(
‘subject’ => $sub,
‘body’ => $body,
$mail_query = str_replace(“+”, “%20”, http_build_query($mail_query));

<a href=”mailto:?<?php echo $mail_query; ?>”>Mail</a>

Full size background image/slider to website flexible using Supersized.js

We can add full size image/slide show of image using supersized.js. For implement we have to follow following steps:

1 . include jquery and supersized js files

<script type=”text/javascript” src=”jquery.js”></script
<script type=”text/javascript” src=”supersized.js”></script>

2. Now add supersized script

<script type=”text/javascript”>


slideshow               :   1,        //Slideshow on/off
autoplay                :    1,        //Slideshow starts playing automatically
start_slide             :   1,        //Start slide (0 is random)
random                    :     0,        //Randomize slide order (Ignores start slide)
slide_interval          :   3000,    //Length between transitions
transition              :   1,         //0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
transition_speed        :    500,    //Speed of transition
new_window                :    1,        //Image links open in new window/tab
pause_hover             :   0,        //Pause slideshow on hover
keyboard_nav            :   1,        //Keyboard navigation on/off
performance                :    1,        //0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
image_protect            :    1,        //Disables image dragging and right click with Javascript
image_path                :    ‘img/’, //Default image path

//Size & Position
min_width                :   0,        //Min width allowed (in pixels)
min_height                :   0,        //Min height allowed (in pixels)
vertical_center         :   1,        //Vertically center background
horizontal_center       :   1,        //Horizontally center background
fit_portrait             :   1,        //Portrait img will not exceed browser height
fit_landscape            :   0,        //Landscape img will not exceed browser width

navigation              :   1,        //Slideshow controls on/off
thumbnail_navigation    :   1,        //Thumbnail navigation
slide_counter           :   1,        //Display slide numbers
slide_captions          :   1,        //Slide caption (Pull from “title” in slides array)
slides                     :      [        //Slideshow img
{image : ‘/static/css/i/bg1.jpg’, title : ‘img’, url : ‘;},




3. Add supersized css now

<link rel=”stylesheet” href=”/css/supersized.css” type=”text/css” media=”screen”>

All above code must be comes within head tags.