2010年1月22日星期五
Re: [fw-mvc] memory usage in zf
hi
i add the codes ... but actually nothing happens in my pages
im using smarty as the view helper
here is bootstrap file :
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initZFDebug()
{
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFDebug');
$options = array(
'plugins' => array('Variables',
'File' => array('base_path' => '/vando'),
'Memory',
'Time',
'Registry',
'Exception')
);
# Instantiate the database adapter and setup the plugin.
# Alternatively just add the plugin like above and rely on the autodiscovery feature.
if ($this->hasPluginResource('db')) {
$this->bootstrap('db');
$db = $this->getPluginResource('db')->getDbAdapter();
$options['plugins']['Database']['adapter'] = $db;
}
# Setup the cache plugin
if ($this->hasPluginResource('cache')) {
$this->bootstrap('cache');
$cache = $this-getPluginResource('cache')->getDbAdapter();
$options['plugins']['Cache']['backend'] = $cache->getBackend();
}
$debug = new ZFDebug_Controller_Plugin_Debug($options);
$this->bootstrap('frontController');
$frontController = $this->getResource('frontController');
$frontController->registerPlugin($debug);
}
}
here is my index.php [main] file :
<?php
// Define path to application directory
defined ( 'APPLICATION_PATH' ) || define ( 'APPLICATION_PATH', realpath ( dirname ( __FILE__ ) . '/../application' ) );
// Define application environment
defined ( 'APPLICATION_ENV' ) || define ( 'APPLICATION_ENV', (getenv ( 'APPLICATION_ENV' ) ? getenv ( 'APPLICATION_ENV' ) : 'production') );
// Ensure library/ is on include_path
set_include_path ( implode ( PATH_SEPARATOR, array (realpath ( APPLICATION_PATH . '/../library' ), get_include_path () ) ) );
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Registry.php';
// Create application, bootstrap, and run
$application = new Zend_Application ( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' );
$config = new Zend_Config_Ini ( APPLICATION_PATH . '/configs/application.ini' );
Zend_Registry::set ( 'config', $config );
/*
* 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);
/*
* caching stuff ...
*/
$frontend = array (lifetime => 345600, automatic_seralization => true );
$backend = array ('cache_dir' => APPLICATION_PATH . '/cache/data/' );
$cache = Zend_Cache::factory('Core','File',$frontend,$backend);
$cache->setOption('automatic_serialization', true);
Zend_Registry::set ( 'cache', $cache );
//end cache
// create the application logger
$pathConfig = $config->get ( 'paths' )->toArray ();
$logger = new Zend_Log ( new Zend_Log_Writer_Stream ( $pathConfig ['debuglogs'] ) );
Zend_Registry::set ( 'logger', $logger );
/*
* Smarty View
*/
// setup the view renderer
require_once APPLICATION_PATH . '/models/Templater.php';
$vr = new Zend_Controller_Action_Helper_ViewRenderer ( );
$vr->setView ( new Templater ( ) );
$vr->setViewSuffix ( 'tpl' );
// some view stuff
Zend_Controller_Action_HelperBroker::addHelper ( $vr );
/*
* Vando Session manager
*/
$vandoses = new vando_Sessions();
$vandoses->removeOldsessions();
$vandoses->addSession();
//Run the Vando
$application->bootstrap ()->run ();
--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin
订阅:
博文评论 (Atom)
没有评论:
发表评论