public function renderBegin() { $response = NEnvironment::getHttpResponse(); if ($this->docType == self::XHTML_1_STRICT && $this->contentType == self::APPLICATION_XHTML && ($this->forceContentType || $this->isClientXhtmlCompatible())) { $contentType = self::APPLICATION_XHTML; if (!headers_sent()) { $response->setHeader('Vary', 'Accept'); } } else { $contentType = self::TEXT_HTML; } if (!headers_sent()) { $response->setContentType($contentType, 'utf-8'); } if ($contentType == self::APPLICATION_XHTML) { echo "<?xml version='1.0' encoding='utf-8'?>\n"; } echo $this->getDocTypeString() . "\n"; echo $this->getHtmlTag()->startTag() . "\n"; echo NHtml::el('head')->startTag() . "\n"; if ($this->docType != self::HTML_5) { $metaLanguage = NHtml::el('meta'); $metaLanguage->attrs['http-equiv'] = 'Content-Language'; $metaLanguage->content($this->language); echo $metaLanguage . "\n"; } $metaContentType = NHtml::el('meta'); $metaContentType->attrs['http-equiv'] = 'Content-Type'; $metaContentType->content($contentType . '; charset=utf-8'); echo $metaContentType . "\n"; echo NHtml::el('title', $this->getTitleString()) . "\n"; if ($this->favicon != '') { echo NHtml::el('link')->rel('shortcut icon')->href(NEnvironment::getVariable('baseUri') . $this->favicon) . "\n"; } foreach ($this->metaTags as $name => $content) { echo NHtml::el('meta')->name($name)->content($content) . "\n"; } }
protected function getHttpResponse() { return NEnvironment::getHttpResponse(); }
<?php /** * My NApplication bootstrap file. * * @copyright Copyright (c) 2010 John Doe * @package MyApplication */ // Step 1: Load Nette Framework // this allows load Nette Framework classes automatically so that // you don't have to litter your code with 'require' statements require LIBS_DIR . '/Nette/loader.php'; // Step 2: Configure environment // 2a) enable NDebug for better exception and error visualisation NDebug::enable(NDebug::DETECT, APP_DIR . '/log/php_error.log', '*****@*****.**'); NEnvironment::getHttpResponse()->enableCompression(); // Load dibi dibi::connect(NEnvironment::getConfig('database')); dibi::addSubst('graweb', 'gw2010__'); // Step 3: Configure application NEnvironment::setVariable("sizes", array(0 => array(880, 330), 1 => array(263, 174), 2 => array(600, 510))); // 3a) get and setup a front controller $application = NEnvironment::getApplication(); $application->errorPresenter = 'Front:Error'; $application->catchExceptions = TRUE; // Step 4: Setup application router $router = $application->getRouter(); $router[] = new NRoute('index.php', array('module' => 'Front', 'presenter' => 'Default'), NRoute::ONE_WAY); $router[] = new NRoute('', array('module' => 'Front', 'presenter' => 'Default', 'action' => 'default')); // Presmerovani starych URL $router[] = new NRoute('internet/<? ceny|postup|sluzby|vyroba>', array('module' => 'Front', 'presenter' => 'Page', 'action' => 'webdesign'), NRoute::ONE_WAY);