2010年1月22日星期五

[fw-mvc] difference between coding in index.php & bootstrap.php

hi

i create the $db object by this code in my root index.php :
/*
 * DB instance
 */
$dbConfig = $config->get ( 'db' )->toArray ();

$db = Zend_Db::factory ( $dbConfig ['adapter'], $dbConfig ['db'] );

try {
    $db->query("SET NAMES 'utf8'");
   
} catch ( Zend_Exception $e ) {
    die ( $e->getMessage () );
}
/*
 * add stuff to registery
 */

//Zend_Registry::set('templateEngine',$templateEngine);
Zend_Registry::set ( 'db', $db );
Zend_Db_Table_Abstract::setDefaultAdapter($db);
$db->getProfiler()->setEnabled(true);

but
i saw lot of example  that doing this in bootstrap.php

what choice is better between this 2 methods of declaring main objects like $db $cache $debug and ...?

what is the difference between using these file ?

--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

没有评论: