error_reporting(E_ALL|E_STRICT);//打開錯誤提示
date_default_timezone_set('Asia/Shanghai');//設定時區
set_include_path('.' . PATH_SEPARATOR . 'library' . PATH_SEPARATOR . 'app/models/' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.PHP';
require_once 'Zend/Controller/Front.PHP';
require_once 'Zend/Db/Table.PHP';
require_once 'Zend/Registry.PHP';
require_once 'Smarty/Smarty.class.PHP';
//Controller設置
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory('app/controllers');
$controller->setDefaultControllerName('Index');
$controller->setDefaultAction('index');
$controller->throwExceptions(true);
//連接數據庫
$conn = array(
'host' => ' ',
'username' =>'',
'passWord' => '',
'dbname' => '',
);
$db = Zend_Db::factory('PDO_MySQL',$conn);
$db->query("SET NAMES UTF8");
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db',$db);//全局存儲
//整合Smarty
$controller->setParam('noVIEwRenderer', true);
$smarty = new Smarty();
$smarty->template_dir = 'app/templates/';
$smarty->compile_dir = 'app/templates_c';
$smarty->cache_dir = 'app/caches';
$smarty->config_dir = 'app/configs';
function smarty_block_dynamic($param,$content,&$smarty){
return $content;
}
$smarty->register_block('dynamic','smarty_block_dynamic',false);
Zend_Registry::set('vIEws', $smarty);
$controller->dispatch();