Prev | Current Page 111 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

'/business/');
// Settings needed to configure the Smarty template engine
define('SMARTY_DIR', SITE_ROOT . '/libs/smarty/');
define('TEMPLATE_DIR', PRESENTATION_DIR . 'templates');
define('COMPILE_DIR', PRESENTATION_DIR . 'templates_c');
define('CONFIG_DIR', SITE_ROOT . '/include/configs');
// These should be true while developing the web site
define('IS_WARNING_FATAL', true);
define('DEBUGGING', true);
// The error types to be reported
define('ERROR_TYPES', E_ALL);
// Settings about mailing the error messages to admin
define('SEND_ERROR_MAIL', false);
define('ADMIN_ERROR_MAIL', 'Administrator@example.com');
define('SENDMAIL_FROM', 'Errors@example.com');
ini_set('sendmail_from', SENDMAIL_FROM);
// By default we don't log errors to a file
define('LOG_ERRORS', false);
define('LOG_ERRORS_FILE', 'c:\\tshirtshop\\errors_log.txt'); // Windows
// define('LOG_ERRORS_FILE', '/home/username/tshirtshop/errors.log'); // Linux
/* Generic error message to be displayed instead of debug info
(when DEBUGGING is false) */
define('SITE_GENERIC_ERROR_MESSAGE', '

TShirtShop Error!

');
?>
2. In the tshirtshop folder, create a subfolder named business.
3. In the business folder, create a file named error_handler.php file, and write the following code:
class ErrorHandler
{
// Private constructor to prevent direct creation of object
private function __construct()
{
}
CHAPTER 3 ?–  STARTING THE TSHIRTSHOP PROJECT 52
/* Set user error-handler method to ErrorHandler::Handler method */
public static function SetHandler($errTypes = ERROR_TYPES)
{
return set_error_handler(array ('ErrorHandler', 'Handler'), $errTypes);
}
// Error handler method
public static function Handler($errNo, $errStr, $errFile, $errLine)
{
/* The first two elements of the backtrace array are irrelevant:
- ErrorHandler.


Pages:
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
akademia pokera teksty piosenek spolszczenia teksty piosenek Hotel SPA Jastrzębia Góra