I prefer initialising all my scripts through a bootstrap script that in turn reads a configuration file. I tend to re-use a common set of configuration parameters.

PHP:
  1. define('DEBUG_PROJECT', false);
  2. define('DISPLAY_ERRORS', true);</code>
  3.  
  4. /**
  5. * E-mail send/receive related
  6. * /
  7. define('EMAIL_CONTACT_ADDRESS', 'webmaster@mysite.com');
  8. define('EMAIL_SERVER_FROM_IDENTITY', 'MySite Webmaster');
  9. define('EMAIL_WEB_ADMINISTRATOR', 'admin@mysite.com');
  10. /**
  11. * Time-related
  12. */
  13.  
  14. //EOT - "end of time"
  15. //Sometimes (but rarely) I need to construct queries that search until the "end of time"
  16. define('EOT_TIMESTAMP', 2145790800);    //2038-01-01 00:00
  17. define('EOT_YEAR', 2037);
  18. define('EOT_MONTH', 12);
  19. define('EOT_DATE',31);
  20.  
  21. define('TIMEZONE', 'Australia/Sydney');
  22.  
  23. /**
  24. * Paths
  25. */
  26. define('PROJECT_HTTP_HOST', 'http://www.mysite.com/');
  27.  
  28. define('PATH_PROJECT',             '/home/bauer/projectX/');
  29. define('PATH_PUBLIC_HTML',         PATH_PROJECT . 'public_html/');
  30. define('PATH_CLASSES',             PATH_PROJECT . 'classes/');
  31. define('PATH_PROJECT_INCLUDES',    PATH_PROJECT . 'includes/');
  32.  
  33. define('PATH_CLIENT_IMAGES',            PATH_PUBLIC_HTML . 'images/client/');
  34. define('PATH_CLIENT_THUMBNAILS_IMAGES',    PATH_CLIENT_IMAGES . 'thumbnails/');
  35.  
  36. define('HTTP_CLIENT_IMAGES',            HTTP_HOST . 'images/client/');
  37. define('HTTP_CLIENT_THUMBNAILS_IMAGES',    HTTP_CLIENT_IMAGES . 'thumbnails/');
  38.  
  39. /**
  40. * Page renderer-related directive
  41. * These parameters are compatible with the Smarty templating engine
  42. */
  43. define('PATH_TEMPLATES',         PATH_PROJECT_INCLUDES . 'templates/');
  44. define('PATH_CURRENT_THEME',     PATH_TEMPLATES . 'current-theme/');
  45. define('SMARTY_TEMPLATE_DIR',     PATH_CURRENT_THEME . 'templates/');
  46. define('SMARTY_COMPILE_DIR',     PATH_CURRENT_THEME . 'templates_c/');
  47. define('SMARTY_CACHE_DIR',         PATH_CURRENT_THEME . 'cache/');
  48. define('SMARTY_CONFIG_DIR',     PATH_CURRENT_THEME . 'configs');

Share
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>