Earlier this week I had an interesting problem. I needed to have some javascript code run from within the page being called via AJAX. The javascript relied on the values being set in the page being called so it could not be setup on the page before hand. It had to be called afterward.
It basically [...]
For work we needed a way to allow the customer to preview what their Bible imprint text would look like before they placed their order. I’m sure there are ways to do this with JavaScript, but we chose to do this with PHP to prevent the site from relying on Javascript (there was already enough [...]
A while back we wrote an article on how to fade images in and out from a single directory using jQuery and another plugin, but today we’re going to add…actually we’re going to totally redo the way we did it in the past. The new way should leave a much smaller footprint.
View Demo
I’m just finishing up a little project to improve the search ability on a website and I want to display an image and message say “loading…” until the script finished running. Below is an easy way to do that.
First just make sure you have the latest version of jQuery.
$(document).ready(function () {
$.get(“script.php”, { keyword: “linein”},
function(data){
document.getElementById(‘text_box’).innerHTML = [...]
10 Nov, 2008
Posted by: john In: mysql| php
Below is an easy to use array of the default full-text stopwords in MySQL taken from MySQL.com.
Here’s the follow-up article on how to easily get file sizes nicely formated. Below is a quick function that will display the file size in KB, MB, or GB all easily accessed through a function.
function formatbytes($file, $type)
{
switch($type){
case “KB”:
$filesize = filesize($file) * .0009765625; // bytes to KB
break;
case “MB”:
$filesize = (filesize($file) * .0009765625) * .0009765625; // bytes [...]
Below is a quick PHP function that allows you to find the time between two dates. The dates must be in seconds from Unix Epoch.
if(!function_exists(timeBetween))
{
function timeBetween($start_date,$end_date)
{
$diff = $end_date-$start_date;
$seconds = 0;
$hours = 0;
$minutes = 0;
if($diff % 86400 0)
{
$rest = ($diff % 86400);
$days = ($diff – $rest) / 86400;
[...]
Almost a year ago I wrote a quick article on how you can strip off characters using PHP’s built in function substr. But after reading it again, even I was not clear how it worked so how would it ever help anyone.
First, if you only want to pull on character from a string, it’s a [...]
You now can look in almost any website or web application where the background colors are alternating. This is a great (and easy) way to improve the user interface for the end users.
Here’s a quick explanation of what’s going on in the demo file below:
First we set the alternating backgrounds we want to use.
$bg1 = [...]
A friend of mine recently requested a quick image rotator script that was not using Flash, but would use Javascript. Below is a script that will read through a single directory and look for any image file (jpg, gif, or png) and rotate it.
Requirements:
PHP
jQuery (latest version)
InnerFade plugin (see docs for variables explanations and additional vars)
// [...]