View Single Post
Old 05-10-2009, 01:50 AM   #15 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Tanax: Take a look at the PHP documentation regarding the exceptions, and how to build your own. You're then able to distinguish between regular exceptions and more specific exceptions, such as database exceptions. With try blocks you're able to have a multitude of catch statements.

Allworknoplay: Consider a simple autoloading function such as the following, perhaps this could be more useful to you for the lazy loader:

php Code:
function __autoload($szClassName)
{
    $szFilePath = str_replace('_', '/', $szClassName) . '.php';
    include_once($szFilePath);
}

new Core_Exception();
new Core_Database_Row();

This, of course, requires you to carefully consider the file structure and naming structure of your files and their classes. I'm quite biased in this approach, because I really love the way that Zend Framework implements their file naming structure. Zend_Db_Row, for example, is instantly identifiable as being located in the file Zend/Db/Row.php.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
allworknoplay (05-10-2009)