Sleek Interactive
4159 Enquist Rd
Campbell River, BC V9H 1A4OFFICE: 778 420 3918
MOBILE: 250 204 6475
*content_window*Reserved words in Javascript "Content_Window" is not the only match in this case....
September 19th, 2011
scrollup(),scrolldown() is not a functionOdd Javascript behaviour scrollup(),scrolldown() is not a function - possible reserved words...
August 31st, 2011
CSS !importantUsing !important with inline styles
August 28th, 2011
Custom CSS CursorsLearn how to add custom cursors to any CSS element in your website....
August 23rd, 2011
Social Networking Timestamp OperatorLearn to create a Timestamp Operator in PHP using the PHP Date function...
August 23rd, 2011
BLOG CATEGORY: PHP | Permalink | Posted on: August 23rd, 2011 |
More and more you see Websites adopting the use of "Standard Social Network Time" or "Less than a minute ago".
It is a lot easier to understand this type of timestamp lingo than check the date and time. It is displaying dynamic data, which makes it a lot more exciting than just having a static date.
I have written a really simple version of a timestamp operator function here:
function lingo_me_timestamp($timestamp){
$ago = time() - strtotime($timestamp);
if($ago < 60){
$output = "Less than a minute ago";
} else if($ago < 3600){
$output = "Less than an hour ago";
} else if($ago < 86400){
$output = "Today";
} else {
$output = "Posted on: " . date("F jS, Y", strtotime($timestamp));
}
return $output;
}
You can adjust times and messages. The more options you have in the function, the more dynamic your date fields end up being.
