目录结构
模板输出结果!
smarty.php
setCompileDir(APPPATH."views/templates_c"); $this->setTemplateDir(APPPATH."views/templates"); $this->setConfigDir(APPPATH.'config/smarty_config'); $this->setCacheDir(APPPATH."cache/smarty_cache"); $this->assign("APPPATH", APPPATH); if (method_exists($this, 'assignByRef')) { $ci =& get_instance(); $this->assignByRef("ci", $ci); } $this->force_compile = 1; $this->caching = true; $this->cache_lifetime = 120; log_message('debug',"Smarty initialized!"); } public function view($template, $return = FALSE) { if (strpos($template, '.') === FALSE && strpos($template, ':') === FALSE) { $template .= '.tpl'; } if ($return==FALSE) { parent::display($template); } else { return parent::fetch($template); } }}
Doctrine.php
register(); $entitiesClassLoader = new ClassLoader('models', rtrim(APPPATH, '/')); $entitiesClassLoader->register(); $proxiesClassLoader = new ClassLoader('Proxies', APPPATH.'models/proxies'); $proxiesClassLoader->register(); // Set up caches $config = new Configuration; $cache = new ArrayCache; $config->setMetadataCacheImpl($cache); $config->setQueryCacheImpl($cache); // Set up driver $Doctrine_AnnotationReader = new \Doctrine\Common\Annotations\AnnotationReader($cache); $Doctrine_AnnotationReader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\'); $driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($Doctrine_AnnotationReader, APPPATH.'models'); $config->setMetadataDriverImpl($driver); // Proxy configuration $config->setProxyDir(APPPATH.'/models/proxies'); $config->setProxyNamespace('Proxies'); // Set up logger //$logger = new EchoSqlLogger; //$config->setSqlLogger($logger); $config->setAutoGenerateProxyClasses( TRUE ); // Database connection information $connectionOptions = array( 'driver' => 'pdo_mysql', 'user' => $db['default']['username'], 'password' => $db['default']['password'], 'host' => $db['default']['hostname'], 'dbname' => $db['default']['database'] ); // Create EntityManager $this->em = EntityManager::create($connectionOptions, $config); } }
下载libraries目录文件