Rotating Arrow Using jQuery


Create a file navigation.html and write the following code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#arrow_box").html(" ");
$("#arrow_box").append("<img src='arrowimages/arrow1.jpg'>");
});
function arrow_navigation(x,y){
var i = x;
var j = y;
$("#arrow_box").html(" ");
$("#arrow_box").append("<img src='arrowimages/arrow"+j+".jpg'>");
}
</script>
<style type="text/css">
#arrow_box1, #arrow_box2, #arrow_box3, #arrow_box4, #arrow_box5, #arrow_box6, #arrow_box7, #arrow_box8, #arrow_box9, #arrow_box10, #arrow_box11, #arrow_box12 {
cursor:pointer;
}
</style> Continue reading 

WordPress Functions and their Meanings


Below is the list of some basic functions used in WordPress Themes.

<?php bloginfo(‘name’); ?> – Title of the Blog, or Blog Name

<?php wp_title(); ?> – Title of a Specific Page

<?php bloginfo(‘url’); ?> – Exact URL for the Site

<?php bloginfo(‘description’); ?> – Site’s Description

<?php bloginfo(‘template_url’); ?> – Location of Site’s Theme File

<?php bloginfo(‘stylesheet_url’); ?> – Link to the Style.css location

<?php bloginfo(‘rss2_url’); ?> – RSS Feed URL for the Site

<?php bloginfo(‘pingback_url’); ?> – Pingback URL for the site

<?php bloginfo(‘version’); ?> – WordPress Version Number

<?php get_header(); ?> – Displays Header.php file content

<?php get_footer(); ?> – Displays Footer.php file content

<?php get_sidebar(); ?> – Displays Sidebar.php file content

<?php comments_template(); ?> – Displays Comment.php file content Continue reading

Get data of yesterday, tomorrow and last week by Mysql query from Database


To get Yesterday’s data from the database table

  1. mysql_query("select * from table where date = ".date("Y-m-d", strtotime("-1 day")));
  2. mysql_query(“select * from table where date = NOW()-INTERVAL 1 DAY”);

To get Tomorrow’s data

  1. mysql_query(“select * from table where date = “.date(“Y-m-d”, strtotime(“+1 day”)));
  2. mysql_query(“select * from table where date = NOW()+INTERVAL 1 DAY”);

To get Last Week data

mysql_query(“select * from tbl where date between NOW() – INTERVAL DAYOFWEEK(NOW())+6 DAY AND NOW() – INTERVAL DAYOFWEEK(NOW())-1 DAY”);

PHP Function to Calculate Age From Date of Birth


There are several times when you need to display the age of the user on your website. There are two ways to do that:

  1. Add Date of Birth column as well as age column.
  2. Display age from the Date of Birth.

Taking both the field from the user doesn’t seems to be good enough, so what to do ?

Just add the following function and you get the age of the user from the Date of Birth.

<?php
function get_age($birth_date)
{
    return floor((time() - strtotime($birth_date))/31556926);
}
echo "I am ".get_age("1989-10-21") ." years old";
?>

Output:

I am 23 years old.

You need to write Date of Birth in yyyy-mm-dd format which is the default database date format.