function actionDefault() { // Register the named instances YDDatabase::registerInstance('default', 'mysql', 'ydweblog', 'root', '', 'localhost'); YDDatabase::registerInstance('db_mysql', 'mysql', 'mysql', 'root', '', 'localhost'); YDDatabase::registerInstance('db_test', 'mysql', 'test', 'root', '', 'localhost'); // Get the default instance $db1 = YDDatabase::getNamedInstance(); YDDebugUtil::dump($db1, 'default instance, no name given'); // Get the default instance using it's name $db1 = YDDatabase::getNamedInstance('DEFAULT'); YDDebugUtil::dump($db1, 'default instance, using name'); // Get the db_mysql instance using it's name $db1 = YDDatabase::getNamedInstance('db_mysql'); YDDebugUtil::dump($db1, 'db_mysql instance'); // Get the db_bba_v2 instance using it's name $db1 = YDDatabase::getNamedInstance('db_test'); YDDebugUtil::dump($db1, 'db_test instance'); }
<?php // initialize the Yellow Duck Framework include_once dirname(__FILE__) . '/../../YDFramework2/YDF2_init.php'; YDInclude('YDDatabase.php'); YDInclude('YDUrl.php'); // BASIC CONFIGURATION: set YDDatabase instance connection YDDatabase::registerInstance('default', 'mysql', 'xpto', 'root', '', 'localhost'); // BASIC CONFIGURATION: set portal language. Currently you can use 'en' and 'pt'. YDLocale::set('en'); // set admin template path YDConfig::set('YDCMTEMPLATES_ADMIN_PATH', dirname(__FILE__) . '/backend/templates'); YDConfig::set('YDCMTEMPLATES_ADMIN_URL', YDUrl::makeLinkAbsolute('./templates'));