[eluser]esra[/eluser]
I use a lot of constants in helper and plugin files and sometimes at the head of some controller files. I modified index.php to require a separate defines file just after APPPATH is defined in index.php.
Code:
/*
|---------------------------------------------------------------
| DEFINE APPLICATION CONSTANTS
|---------------------------------------------------------------
|
| EXT - The file extension. Typically ".php"
| FCPATH - The full server path to THIS file
| SELF - The name of THIS file (typically "index.php)
| BASEPATH - The full server path to the "system" folder
| APPPATH - The full server path to the "application" folder
|
*/
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
if (is_dir($application_folder))
{
define('APPPATH', $application_folder.'/');
}
else
{
if ($application_folder == '')
{
$application_folder = 'applications';
}
define('APPPATH', $application_folder.'/');
}
// Include additional constants
$defines_file = 'includes/defines.php';
if (file_exists($defines_file))
{
require_once($defines_file);
}
Then you can add whatever constants you need quickly. In the above, I store the defines.php under includes/.