Zend Framework function to check if a class is accessible.
// Check to see if there is a Comment Model
if (Zend_Loader_Autoloader::autoload('Default_Model_DBTable_Comment')) {
// Save the comment into the database
$table = new Default_Model_DBTable_Comment();
$table->insert($data);
} else {
echo 'NO WAY';
}
Very useful when trying to create a modular site system. This way we can determine for instance if a site should have the ability to log questions posted on the contact page or not, based on whether they have the model available to handle the transactions.
Obvious overhead in if_file_exists calls made.
Comments
Leave a comment