Archive for the 'Coding' Category

isDivisible function for PHP

A quick function to check if a number is divisible by another.
PLAIN TEXT
PHP:

function isDivisible($number, $divisibleBy)

    {

    if ($number % $divisibleBy == 0)

        return true;

    return false;

    }

WordPress: Get custom field function

On several WordPress projects I've needed to get the value of a custom field.  Not too difficult using the get_post_meta command, but I wanted a little quicker way.  So I now add this little function to the functions.php file on themes I'm working on.
PLAIN TEXT
PHP:

function getMeta($key)

{

global $post;

return get_post_meta($post->ID, $key);

}

Say you've got a custom field [...]

JavaScript progress bar indicator

Need a way to show the progress on a long process on your web page? Here's a quick little JavaScript routine that will do it for you.

Bookmarking threads on an SMF board

This is one of those features I've been wanting to add to my photography forum for a while now, but I just got around to it this weekend.
With the addition of a database table, a new template file, a few source files, and changes to several others, my Simple Machines Forum now gives my users [...]

Why blocking right-clicks is a waste of time

There's another forum I'm on where the discussion of blocking right-clicks comes up every few days it seems.  People put up their first website and are terrified when they find out how easy it is to right-click on an image and save it.
The problem is that it's trivial for anyone with a moderate amount of [...]