コード例 #1
0
 public function init()
 {
     parent::init();
     $this->view->doctype('XHTML1_STRICT');
     $this->view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
     $this->_helper->viewRenderer->setNoRender(true);
     $this->view->getHelper('baseUrl')->setBaseUrl(BASE_URL);
     defined('LAST_TEMP') || define('LAST_TEMP', BASE_URL . UDS . Base_Constant_Server::LAST_TEMP_DIRECTORY . UDS);
     $registry = Zend_Registry::getInstance();
     $registry->moduleName = $this->_request->getModuleName();
     $registry->controllerName = $this->_request->getControllerName();
     $registry->actionName = $this->_request->getActionName();
     $modulePath = $registry->modulePaths[$registry->moduleName];
     $controllerPath = $registry->controllerPaths[$registry->moduleName];
     $registry->modulePath = $modulePath;
     $this->view->moduleName = $registry->moduleName;
     $this->view->controllerName = $registry->controllerName;
     $this->view->actionName = $registry->actionName;
     /** title page, site name, meta tag*/
     //$this->view->siteName = $registry->appConfig['siteName'];
     $hTranslate = new Base_Helper_Translate();
     $this->view->siteName = $hTranslate->translate(Base_Constant_Client::getInstance()->getSetting('siteName'), 'value');
     $description = '<meta name="description" content="' . $hTranslate->translate(Base_Constant_Client::getInstance()->getSetting('meta_desc'), 'value') . '">';
     $keywords = '<meta name="keywords" content="' . $hTranslate->translate(Base_Constant_Client::getInstance()->getSetting('meta_keywords'), 'value') . '">';
     $author = '<meta name="author" content="' . $hTranslate->translate(Base_Constant_Client::getInstance()->getSetting('meta_author'), 'value') . '">';
     $this->view->metaTag = $description . $keywords . $author;
     /** title page, site name, meta tag*/
     $layoutPath = $modulePath . DS . 'views' . DS . 'layouts';
     if (!is_dir($layoutPath)) {
         $layoutPath = WWW_PATH . DS . 'views' . DS . 'layouts';
     }
     Zend_Layout::startMVC(array("layout" => 'layout', "layoutPath" => $layoutPath));
     $registry['mvcOptions'] = array("layout" => 'layout', "layoutPath" => $layoutPath);
     is_null($this->_request->getParam('ajax')) || $this->_helper->layout()->disableLayout();
     $registry->headLink = $this->_cacheHeadLink();
     $registry->headScript = $this->_cacheHeadScript();
     $registry->currentUser = new Base_Php_Overloader(Zend_Auth::getInstance()->getIdentity());
     $this->initOther();
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: aldimol/zf-sample
 /**
  *	Initialize the main layout handler.
  *	@return Zend_Layout
  */
 protected function _initLayout()
 {
     $layout = (array) $this->getResource('layout');
     $this->_layout = Zend_Layout::startMVC($layout);
     Zend_Registry::getInstance()->set('layout', $this->_layout);
     return $this->_layout;
 }
コード例 #3
0
ファイル: index.php プロジェクト: neilgarb/codecaine
<?php

// bootstrap
define('BASE', dirname(dirname(__FILE__)));
date_default_timezone_set('Africa/Johannesburg');
set_include_path(get_include_path() . PATH_SEPARATOR . '/usr/share/php5/ZendFramework/library' . PATH_SEPARATOR . BASE . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'models' . PATH_SEPARATOR . BASE . DIRECTORY_SEPARATOR . 'lib');
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
// load config
$config = new Zend_Config_Ini(BASE . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config.ini', 'live');
Zend_Registry::set('config', $config);
// connect to the database
$db = Zend_Db::factory($config->db->adapter, $config->db->conn->toArray());
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
// view
Zend_Layout::startMVC();
// dispatch
$front = Zend_Controller_Front::getInstance();
$front->setRouter(new App_Controller_Router());
$front->setControllerDirectory(BASE . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'controllers');
$front->dispatch();
コード例 #4
0
 public function exportAction()
 {
     $this->view->param = $this->_request;
     $option = array("layout" => "index", "layoutPath" => APPLICATION_PATH . "/layouts/export");
     Zend_Layout::startMVC($option);
 }