From 8267b102939626201641e53be9c844a081422f5c Mon Sep 17 00:00:00 2001 From: PiTiLeZarD Date: Wed, 19 Mar 2008 18:02:11 +0100 Subject: [PATCH] better info, assign it to template and use infos instead of info everywhere ... --- config.ini | 2 ++ kernel.php | 17 +++++++++++------ lib/pimp/Href.php | 6 +++--- pimpmyv.tmproj | 4 ++-- site/views/Layouts/default.tpl | 6 +++--- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/config.ini b/config.ini index 7b054f1..b5879af 100644 --- a/config.ini +++ b/config.ini @@ -6,3 +6,5 @@ db.host = localhost db.user = remote db.password = remote db.name = pimpmyv + +contactmail = contact@pimpmyv.com \ No newline at end of file diff --git a/kernel.php b/kernel.php index 8d735b4..a0ac331 100644 --- a/kernel.php +++ b/kernel.php @@ -39,7 +39,7 @@ class Kernel { public function __construct() { $h = $_SERVER['HTTP_HOST']; - $this->info=array( + $this->infos = array( "host" => $h, "dest" => 'live', "httphost" => "http://".$h."/" @@ -63,6 +63,9 @@ class Kernel { $fn = 'init' . $fn; $this->$fn(); } + + # register infos in the view + Zend_Registry::get('view')->infos = $this->infos; } private function initDomain() { @@ -91,9 +94,9 @@ class Kernel { $this->i18n = new Zend_Translate('gettext', $moPath, $this->locale); # fill info - $this->info['domain'] = $this->VARS['domain']; - $this->info['httphosti18n'] = "http://".$this->info['httphost']."/".$this->VARS['domain']."/"; - $this->info['locale'] = $this->locale->getLanguage() . '_' . $this->locale->getRegion(); + $this->infos['domain'] = $this->VARS['domain']; + $this->infos['httphosti18n'] = "http://".$this->infos['httphost'].$this->VARS['domain']."/"; + $this->infos['locale'] = $this->locale->getLanguage() . '_' . $this->locale->getRegion(); } @@ -140,6 +143,7 @@ class Kernel { $view->setEncoding('UTF-8'); $view->setScriptPath('./site/views/Pages/'); $view->setHelperPath('./site/views/Helpers/'); + Zend_Registry::set('view', $view); # modify the viewRenderer default behaviour $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer'); @@ -153,7 +157,6 @@ class Kernel { $layout->setLayoutPath('./site/views/Layouts/'); $layout->setViewSuffix('tpl'); # todo follow if Zend_Layout use inflector from the view renderer in next relases - } private function initVars() { @@ -168,7 +171,9 @@ class Kernel { } private function initConfig() { - $this->config = new Zend_Config_Ini('config.ini', $this->info['dest']); + $this->config = new Zend_Config_Ini('config.ini', $this->infos['dest']); + + $this->infos['contactmail'] = $this->config->contactmail; } private function initDB() { diff --git a/lib/pimp/Href.php b/lib/pimp/Href.php index 1eb3c34..8d7ac90 100644 --- a/lib/pimp/Href.php +++ b/lib/pimp/Href.php @@ -6,15 +6,15 @@ class Href { $K = Kernel::getInstance(); if ($url[0] == ';') { - $url = $K->info['httphost'] . substr($url, 1, strlen($url)); + $url = $K->infos['httphost'] . substr($url, 1, strlen($url)); } if (($url[0] == '/') || ($url[0] == ':')) { - $url = $K->info['httphosti18n'] . substr($url, 1, strlen($url)); + $url = $K->infos['httphosti18n'] . substr($url, 1, strlen($url)); } if (strpos($url, "http")!==0) { - $url = $K->info['httphosti18n'] . $url; + $url = $K->infos['httphosti18n'] . $url; } $u = Zend_Uri::factory($url); diff --git a/pimpmyv.tmproj b/pimpmyv.tmproj index e7c0a9e..d3af5a4 100644 --- a/pimpmyv.tmproj +++ b/pimpmyv.tmproj @@ -16,12 +16,12 @@ fileHierarchyDrawerWidth - 200 + 334 metaData showFileHierarchyDrawer windowFrame - {{400, 43}, {897, 571}} + {{435, 184}, {897, 571}} diff --git a/site/views/Layouts/default.tpl b/site/views/Layouts/default.tpl index 0349d5b..b246ca5 100644 --- a/site/views/Layouts/default.tpl +++ b/site/views/Layouts/default.tpl @@ -1,12 +1,12 @@ docType('XHTML1_STRICT') ?> - + - + - + -- 2.11.4.GIT