If you have mobile version of website and want to redirect to appropriate devices this code could be useful.
Add this code to header or index.php file.
window.location='http://www.phpmind.com'";
}
?>
This is how you can add number of days in a date string using JavaScript.
In this example i have added 6 days in a date. Please check the demo.
var someDate = new Date("2014-06-20");
var numberOfDaysToAdd = 6; // add 6 days
someDate.setDate(someDate.getDate() + numberOfDaysToAdd);
var dd = someDate.getDate();
var mm = someDate.getMonth() + 1;
var y = someDate.getFullYear();
var someFormattedDate = y +'-'+ mm +'-'+dd;
// output 2014-06-25
Another example using php.
You can add any number of days if you want to reduce number of days use minus(-) sign instead.
There are 2 ways to convert Seconds into minute. Its super simple.
One -
$seconds = "110";
$minutes = floor($seconds/60);
$secondsleft = $seconds%60;
if($minutes<10)
$minutes = "0" . $minutes;
if($secondsleft<10)
$secondsleft = "0" . $secondsleft;
echo "$minutes:$secondsleft Sec";
echo "
";
Two -
echo gmdate("i.s", $seconds);
On this property, effect take place in an element smoothly over a given time period. Specifying duration is compulsory to see the effect. We need to specify transition-property, transition-duration, transition-timing-function and finally transition-delay.
Web designers can easily provide beautiful effects with the help of transition withoutusing jquery.
Hover
Browser support: Firefox, Chrome, Opera, IE10+, and Safari. Add prefix -webkit- for chrome 25 and its earlier versions and safari.
Add prefix -moz- for firefox.
Add prefix -ms- for IE.
.div
{
border-radius:90px;
width:120px;
height:120px;
background:#F60;
}
.div:hover
{
width:150px;
height:150px;
transition-property:width;
-webkit-transition-property: width, height; /* Safari */
-moz-transition-property: width, height; /* Firefox 4 */
-o-transition-property:width, height; /* Opera */
transition-duration: 3s;
-webkit-transition-duration: 3s; /* Safari */
}
hover
Here transition property is applies to width and height.
.div
{
position:absolute;
left:0;
opacity: 1;
transition: opacity 2s ease-in 2s;
-o-transition: opacity 2s ease-in 2s;
-webkit-transition: opacity 2s ease-in 2s;
-moz-transition: opacity 2s ease-in 2s;
-ms-transition: opacity 2s ease-in 2s;
}
In the above example image fading starts after 2 seconds.
Add prefix -ms- for IE9.
.div{
transform:translate(110px,45px);
-webkit-transform:translate(110px,45px); /* Safari and Chrome */
-ms-transform:translate(110px,45px); /* TO SUPPORT INTERNET EXPLORER 9 */
background:#00CC66;
width:100px;
height:100px;
}
.div{
transform: rotate(50deg);
-webkit-transform: rotate(50deg); /* Safari and Chrome */
-ms-transform: rotate(50deg); /* TO SUPPORT INTERNET EXPLORER 9 */
background:#00CC66;
width:100px;
height:100px;
}
.div{
transform: scale(1.5,1.5);
-webkit-transform: scale(1.5,1.5); /* Safari and Chrome */
-ms-transform: scale(1.5,1.5); /* TO SUPPORT INTERNET EXPLORER 9 */
background:#00CC66;
width:100px;
height:100px;
}
.div{
transform: skew(20deg, 20deg);
-webkit-transform: skew(20deg, 20deg); /* Safari and Chrome */
-ms-transform: skew(20deg, 20deg); /* TO SUPPORT INTERNET EXPLORER 9 */
background:#00CC66;
width:100px;
height:100px;
}
.div{
transform: skew(20deg, 20deg);
-webkit-transform: skew(20deg, 20deg); /* Safari and Chrome */
-ms-transform: skew(20deg, 20deg); /* TO SUPPORT INTERNET EXPLORER 9 */
background:#00CC66;
width:100px;
height:100px;
}
I created a function to convert PHP Object to Array.
The main function remove unnecessary data from the object.
Second loop gives you straight array. You can manipulate it as you want to display PHP Array data.
function phpObjectToArray($phpObject)
{
if(!is_object($phpObject) && !is_array($phpObject))
return $phpObject;
$phpArray=array();
foreach($phpObject as $member=>$data)
{
$phpArray[$member]=phpObjectToArray($data);
}
return $phpArray;
}
$scopeArray = phpObjectToArray($show_scope_data);
echo"";
print_r($scopeArray);
Output after passing object.
Array
(
[0] => Array
(
[data] => Array
(
[ekey] => 1
[ecode] => UNKNOWN
[ename] => Unknown Name
[edesc] => Name has an unknown scope
[flag] => 1
)
)
[1] => Array
(
[data] => Array
(
[ekey] => 2
[ecode] => GLOBAL
[ename] => This Scope Name
[edesc] => Name applies to all sites
[flag] => 1
)
)
[2] => Array
(
[data] => Array
(
[ekey] => 3
[ecode] => PHPMIND
[ename] => PHPMIND Scope Name
[edesc] => PHPMIND applies to all tuto
[flag] => 1
)
)
[3] => Array
(
[data] => Array
(
[ekey] => 4
[ecode] => PHP Technology
[ename] => PHP Technology Scope Name
[edesc] => PHP Technology applies to all tuto
[flag] => 1
)
)
[4] => Array
(
[data] => Array
(
[ekey] => 5
[ecode] => CSS2
[ename] => CSS2 Scope Name
[edesc] => CSS2 applies to all css2 tuto
[flag] => 1
)
)
[5] => Array
(
[data] => Array
(
[ekey] => 6
[ecode] => HTML5
[ename] => HTML5 Scope Name
[edesc] => HTML5 Name applies to a HTML5 tuto
[flag] => 1
)
)
)
$array_list = array();
foreach($scopeArray as $key=>$value)
{
$array_list[$key]= $scopeArray[$key]["data"];
}
print_r($array_list);
Last print_r() function will display normal array.
.div{
background:url(phpmind-background-size-image.jpg);
background-size: contain;
background-repeat:no-repeat;
width: 600px;
height:300px;
border:1px solid #999;
}
.div{
background:url(phpmind-background-size-image.jpg);
background-size: cover;
background-repeat:no-repeat;
width: 600px;
height:300px;
border:1px solid #999;
}
.div{
background:url(phpmind-background-size-image.jpg);
background-size:200px;
background-repeat:no-repeat;
width: 500px;
height:300px;
border:1px solid #999;
}
.div{
background:url(phpmind-background-size-image.jpg);
background-size:80% 50%;
background-repeat:no-repeat;
width: 500px;
height:300px;
border:1px solid #999;
}
Browser support: Firefox 4+, Safari 5+, IE9+, Chrome, and Opera.
.div{
background:url(phpmind-background-origin.jpg);
background-origin: content-box;
background-repeat: no-repeat;
width: 300px;
height:300px;
padding:20px;
border:10px dotted #39C;
}
.div{
background:url(phpmind-background-origin.jpg);
background-origin: padding-box;
background-repeat: no-repeat;
width: 300px;
height:300px;
padding:20px;
border:10px dotted #39C;
}
.div{
background:url(phpmind-background-origin.jpg);
background-origin: border-box;
background-repeat: no-repeat;
width: 300px;
height:300px;
padding:20px;
border:10px dotted #39C;
}
Browser support: Firefox 4+, Safari 5+, IE9+, Chrome, and Opera.
.div{
background:#9CC;
background-clip: content-box;/*padding-box, border-box or content-box as per need*/
background-repeat: no-repeat;
width: 100px;
height:100px;
padding:20px;
border:10px dotted #39C;
float:left;
}
content box
padding box
border box
Browser support: Firefox, IE9+, Chrome, Opera and Safari.
p{
font-family:Verdana, Geneva, sans-serif;
font-size:24px;
font-weight:bold;
color:#006600;
text-align:justify;
text-shadow: 4px 4px 7px #009900;
}
div{
background:#EFEFEF;
border: 1px solid #999999;
color: #333333;
padding: 10px;
width: 200px;
word-wrap: break-word;
}
This word is very longgggggggggggggggggggggggggggggggggggggggggggggggggg to fit in a div. We can break it by using word-wrap property.
div{
border:3px solid #666666;
padding:10px auto;
background:#73C22D;
width:350px;
border-radius:30px;
}
div{
border:3px solid #a1a1a1;
padding:10px auto;
background:#ccc;
width:350px;
box-shadow: 5px 5px 8px 10px #666666 inset;
}
This property is compatible with all modern browsers. But to maintain compatibility with old browser it is suggested to add prefix -moz- for mozilla, -webkit- for safari.and -o- for opera.
div{
background: #FF6;
padding: 10px 5px;
width: 450px;
border:20px solid transparent;
border-image: url(phpmind-border-image-eg.png) 30 30 round;
}
text-shadow: 0 1px 0 #3cc4fc,
0 2px 0 #4fcbfe,
0 2px 0 #5dd0ff,
0 3px 0 #6bd3fe,
0 4px 0 #78d5fc,
0 4px 1px rgba(0,0,0,.1),
0 0 5px rgba(0,0,0,.1),
0 1px 3px rgba(0,0,0,.3),
0 3px 5px rgba(0,0,0,.2),
0 5px 10px rgba(0,0,0,.25),
0 10px 10px rgba(0,0,0,.2),
0 20px 20px rgba(0,0,0,.15);
}