24 ways to impress your friends

Jump to menu

Vote down?

Fabrice Delaneau

A bit out of this topic but might be helpful for the PHP part :
Real constants, not variables, exists indeed in PHP

define(“CONSTANT_NAME”,“constant value”);

I usually use it to define the installation path of my sites, this allows me to easily move a site into subfolders.

define(‘INSTALL_PATH’, ‘/folder-name’);
$url = INSTALL_PATH.’/path/of/the/files’;

Also, the constant name doesn’t need to be in full uppercase but it makes it easier to spot in your code later.

As for the CSS constant this seems a nice to go, specially on big files or if you work in a team.