protected function _initView() { $this->bootstrap(array('request')); // Initialize view $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->doctype('XHTML1_STRICT'); $view->headTitle()->setSeparator(' » '); // Save the base URL $view->baseUrl = $this->getResource('request')->getBaseUrl(); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); // Add some stylesheet $view->headLink()->appendStylesheet($view->baseUrl . '/css/default.css'); // Set user info /* $session = $this->getResource('session'); $view->userLoggedIn = $session->logged_in; $view->userInfo = $session->user; */ $view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'SimpleCal_View_Helper_'); Zend_Dojo::enableView($view); // Return it, so that it can be stored by the bootstrap return $view; }
protected function _initView() { //INICIAR PLUGIN PARA CADA MODULE TER SEU LAYOUT $view = new Zend_View(); $view->setEncoding('UTF-8'); Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/modules/default/layouts/scripts', 'layout' => 'default', 'pluginClass' => 'App_Plugins_SetLayout')); }
/** * @covers Robo47_View_Helper_Gravatar::Gravatar * @dataProvider gravatarProvider */ public function testGravatar($email, $size, $rating, $default, $ssl, $separator, $params) { $view = new Zend_View(); $view->setEncoding('utf-8'); $view->Doctype(Zend_View_Helper_Doctype::XHTML1_STRICT); $service = new Robo47_Service_Gravatar(); $helper = new Robo47_View_Helper_Gravatar($service); $helper->setView($view); $gravatarImageTag = $helper->Gravatar($email, $size, $rating, $default, $ssl, $separator, $params); $src = $service->getUri($email, $size, $rating, $default, $ssl, $separator); $alt = 'Gravatar ' . $service->getGravatarHash($email); libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML('<html><head><title></title></head><body>' . $gravatarImageTag . '</body></html>'); libxml_use_internal_errors(false); $nodes = $dom->getElementsByTagName('img'); $this->assertEquals(1, $nodes->length); $image = $nodes->item(0); $this->assertTrue($image->hasAttribute('src'), 'Image has no attribute "href"'); $this->assertTrue($image->hasAttribute('alt'), 'Image has no alt'); foreach ($params as $param => $value) { $this->assertTrue($image->hasAttribute($param), 'Image has no attribute "' . $param . '"'); $this->assertEquals($value, $image->getAttribute($param), 'Image attribute "' . $param . '" has wrong value'); } $srcAttribute = $image->getAttribute('src'); $this->assertEquals($src, $srcAttribute, 'Image attribute "src" has wrong value'); if (isset($params['alt'])) { $altAttribute = $image->getAttribute('alt'); $this->assertEquals($params['alt'], $altAttribute, 'Image attribute "alt" has wrong value'); } else { $altAttribute = $image->getAttribute('alt'); $this->assertEquals($alt, $altAttribute, 'Image attribute "alt" has wrong value'); } }
/** * Send email notification to moderators when a new comment is posted * * @todo move logic to model / library class * * @param HumanHelp_Model_Comment $comment * @param HumanHelp_Model_Page $page */ public function _sendNewCommentEmail(HumanHelp_Model_Comment $comment, HumanHelp_Model_Page $page) { $config = Zend_Registry::get('config'); $emailTemplate = new Zend_View(); $emailTemplate->setScriptPath(APPLICATION_PATH . '/views/emails'); $emailTemplate->addHelperPath(APPLICATION_PATH . '/views/helpers', 'HumanHelp_View_Helper_'); $emailTemplate->setEncoding('UTF-8'); $emailTemplate->comment = $comment; $emailTemplate->page = $page; $emailTemplate->baseUrl = 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl; $bodyHtml = $emailTemplate->render('newComment.phtml'); $bodyText = $emailTemplate->render('newComment.ptxt'); $mail = new Zend_Mail(); $mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE)->setBodyHtml($bodyHtml, 'UTF-8')->setBodyText($bodyText, 'UTF-8')->setSubject("New comment on '{$page->getTitle()}' in '{$page->getBook()->getTitle()}'")->setFrom($config->fromAddress, $config->fromName); if (is_object($config->notifyComments)) { foreach ($config->notifyComments->toArray() as $rcpt) { $mail->addTo($rcpt); } } else { $mail->addTo($config->notifyComments); } if ($config->smtpServer) { $transport = new Zend_Mail_Transport_Smtp($config->smtpServer, $config->smtpOptions->toArray()); } else { $transport = new Zend_Mail_Transport_Sendmail(); } $mail->send($transport); }
protected function _initView() { $view = new Zend_View(); // snip... $view->setEncoding('win-1251'); // snip... return $view; }
public static function setupView() { $view = new Zend_View(); $view->setEncoding('UTF-8'); Zend_Layout::startMvc(array('layoutPath' => self::$root . 'application/default/views/layouts', 'layout' => 'layout')); $registry = Zend_Registry::getInstance(); $registry->set('view', $view); }
protected function _initView() { $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->doctype(Zend_View_Helper_Doctype::XHTML11); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); Zend_Registry::set('view', $view); }
protected function _initView() { ini_set('default_charset', 'UTF-8'); $view = new Zend_View(); // snip... $view->setEncoding('utf-8'); // snip... return $view; }
public function setupView($crt_theme) { $view = new Zend_View(); $view->setEncoding('UTF-8'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); $view->setScriptPath($this->root . '/application/' . $crt_theme . '/scripts/'); $view->setHelperPath($this->root . '/application/' . $crt_theme . '/helpers'); $this->layout = Zend_Layout::startMvc(array('layoutPath' => $this->root . '/application/' . $crt_theme . '/layouts', 'layout' => 'layout')); }
/** * the doctype is now also declared in the bootstrap... * */ protected function _initView() { //$this->bootstrap('view'); //$view = $this->getResource('view'); //$view->doctype('XHTML11'); $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->doctype('XHTML11'); return $view; }
protected function _initView() { $view = new Zend_View(); $view->doctype('XHTML1_TRANSITIONAL'); $view->setEncoding('UTF-8'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')->appendHttpEquiv('Content-Language', 'en-US'); $view->headTitle('Chargify Sample App')->setSeparator(' | '); $view->addHelperPath('Crucial/View/Helper/', 'Crucial_View_Helper'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); }
public function render(Zend_View_Interface $view = null) { if (!$this->_template) { return parent::render($view); } else { $root = Zend_Registry::get('root'); $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->setScriptPath("{$root}/application/pages/views/forms/"); $view->form = $this; return $view->render($this->_template); } }
protected function _initView() { $path = APPLICATION_PATH . '/modules/' . MODULE_NAME . '/views'; $view = new Zend_View(); $view->setUseStreamWrapper(true); $view->setEncoding('UTF-8'); $view->addScriptPath($path . '/partials'); $view->addScriptPath($path . '/scripts'); $view->addHelperPath(APPLICATION_PATH . '/../library/Bbx/View/Helper', 'Bbx_View_Helper'); $view->addHelperPath($path . '/helpers', 'ViewHelper'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); Zend_Registry::set('view', $view); }
protected function _initView() { // Initialize view $view = new Zend_View(); $view->doctype('XHTML1_STRICT'); $view->setEncoding('utf-8'); $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8'); // Add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers'); // Return it, so that it can be stored by the bootstrap return $view; }
function initView() { $view = new Zend_View(); $view->setEncoding('UTF-8'); $fc = Zend_Controller_Front::getInstance(); $cs = $fc->getControllerDirectory(); $prefixes = array_keys($cs); foreach ($prefixes as $prefix) { $viewdir = dirname(dirname(__FILE__)) . '/Views/'; $view->addScriptPath($viewdir . 'Scripts'); $view->addHelperPath($viewdir . 'Helpers', $prefix . '_View_Helper_'); } $page = new Strass_Page(new Wtk_Metas(array('DC.Title' => 'Installation', 'DC.Language' => 'fr', 'site' => 'Installation'))); Zend_Registry::set('page', $page); return $view; }
public function email($orderId) { $orderInfo = TCVM_Order_Factory::Factory()->getOrder($orderId); $zendView = new Zend_View(); $zendView->assign("orderInfo", $orderInfo); $zendView->setEncoding('UTF-8'); $path = realpath(dirname(__FILE__)); $zendView->setScriptPath($path); $html = $zendView->render("success.phtml"); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=utf-8" . "\r\n"; $headers .= 'From: admin@tcvm.com.au' . "\r\n" . 'Reply-To: admin@tcvm.com.au' . "\r\n"; $to = array($orderInfo["email"], "*****@*****.**", "*****@*****.**", "*****@*****.**"); foreach ($to as $emailA) { @mail($emailA, "TCVM Course Booking", $html, $headers); } }
protected function _initView() { // initialize view $view = new Zend_View(); // doctype $view->doctype('XHTML1_STRICT'); // encoding $view->setEncoding('UTF-8'); // title $view->headTitle('Ofelia')->setSeparator(' | ')->setIndent(8); // meta tags $view->headMeta()->setHttpEquiv('Content-Type', 'text/html; charset=UTF-8')->appendHttpEquiv('Content-Language', 'en-US')->setName('keywords', 'Ofelia, Open-ended Front-end')->appendName('description', "PHPCabal's Open-ended Front-end")->appendName('google-site-verification', '')->setIndent(8); // stylesheets & feeds (headLinks) $view->headLink()->setStylesheet('/css/default.css', 'all')->appendStylesheet('/css/menu.css', 'all')->headLink(array('rel' => 'favicon', 'href' => '/images/favicon.ico'), 'PREPEND')->headLink(array('rel' => 'shortcut icon', 'href' => '/images/favicon.ico'), 'PREPEND')->appendAlternate('/feed/', 'application/rss+xml', 'Noticias Generales')->setIndent(8); // javascript $view->headScript()->appendFile('/js/default.js', 'text/javascript', array('charset' => 'utf-8'))->setIndent(8); // add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); // return it, so that it can be stored by the bootstrap return $view; }
protected function _initView() { // Création et paramétrage de la vue $view = new Zend_View(); $view->setEncoding('utf-8'); $view->headMeta()->setHttpEquiv('Content-type', 'text/html; charset=utf-8'); // Activation de jQuery $view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper'); $jquery = $view->jQuery(); $jquery->enable(); // Si vous ne souhaitez pas utiliser google // on peut demander r ZendX _ JQuery de travailler // avec une bibliothcque locale //$rmode = ZendX _ JQuery::RENDER _ JQUERY _ ON _ LOAD // | ZendX _ JQuery::RENDER _ SOURCES; //$jquery->setRenderMode($rmode); //$jquery->addJavascriptFile('../scripts/jquery-1.3.2.min.js'); // Enregistrement de l’objet $view comme vue principale $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer(); $viewRenderer->setView($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $view; }
protected function _initView() { // Create view $view = new Zend_View(); // Set encoding (@todo maybe use configuration?) $view->setEncoding('utf-8'); $view->addScriptPath(APPLICATION_PATH); // Setup and register viewRenderer // @todo we may not need to override zend's $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); //$viewRenderer = new Engine_Controller_Action_Helper_ViewRenderer($view); $viewRenderer->setViewSuffix('phtml'); Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, $viewRenderer); // Add default helper paths $view->addHelperPath('Khcn/View/Helper/', 'Khcn_View_Helper_'); $this->initViewHelperPath(); // Set doctype $doctypeHelper = new Zend_View_Helper_Doctype(); $doctypeHelper->doctype('XHTML1_STRICT'); // Add to local container and registry Zend_Registry::set('Zend_View', $view); return $view; }
protected function _initView() { // initialize view $view = new Zend_View(); // get it's configuration file $site = new Zend_Config_Ini(APPLICATION_PATH . '/configs/site.ini', APPLICATION_ENV); // doctype $view->doctype($site->doctype); // encoding $view->setEncoding($site->encoding); // title $view->headTitle($site->name)->setSeparator(' | ')->setIndent(8); // meta tags $view->headMeta()->setName('keywords', $site->keywords)->appendName('description', $site->description)->appendName('google-site-verification', $site->googleVerification)->setIndent(8); // stylesheets & feeds (headLinks) $view->headLink()->setStylesheet('/css/layout.css', 'all')->appendStylesheet('/css/default.css', 'all')->appendStylesheet('/css/menu.css', 'all')->headLink(array('rel' => 'favicon', 'href' => '/images/favicon.ico'), 'PREPEND')->headLink(array('rel' => 'shortcut icon', 'href' => '/images/favicon.ico'), 'PREPEND')->appendAlternate('/feed/', 'application/rss+xml', 'News')->setIndent(8); // javascript $view->headScript()->appendFile('/js/default.js', 'text/javascript', array('charset' => $site->encoding))->setIndent(8); // add it to the ViewRenderer $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); // return it, so that it can be stored by the bootstrap return $view; }
/** * Configure the view. */ public static function setupView() { // Create a new instance. $view = new Zend_View(); // Set the encoding. $view->setEncoding('UTF-8'); // Get a renderer and add it as a helper. $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); // Set the layout. Zend_Layout::startMvc(array('layoutPath' => array(self::$root . '/application/modules/default/views/layouts', self::$root . '/application/modules/user/views/layouts'), 'layout' => 'default')); }
protected function _initView() { $view = new Zend_View(); $view->setEncoding('utf-8'); $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); $viewRenderer->setViewSuffix('tpl'); $view->addHelperPath(APPLICATION_PATH . '/application/libraries/Engine/View/Helper', 'Engine_View_Helper'); $view->addHelperPath(APPLICATION_PATH . '/install/views/helpers', 'Install_View_Helper'); Zend_Registry::set('Zend_View', $view); return $view; }
protected function _initView() { // Create view $view = new Zend_View(); // Set encoding (@todo maybe use configuration?) $view->setEncoding('utf-8'); $view->addScriptPath(APPLICATION_PATH); // Setup and register viewRenderer // @todo we may not need to override zend's $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); //$viewRenderer = new Engine_Controller_Action_Helper_ViewRenderer($view); $viewRenderer->setViewSuffix('tpl'); Zend_Controller_Action_HelperBroker::getStack()->offsetSet(-80, $viewRenderer); // Initialize contextSwitch helper Zend_Controller_Action_HelperBroker::addHelper(new Core_Controller_Action_Helper_ContextSwitch()); // Add default helper paths $view->addHelperPath('Engine/View/Helper/', 'Engine_View_Helper_'); $this->initViewHelperPath(); // Set doctype Engine_Loader::loadClass('Zend_View_Helper_Doctype'); $doctypeHelper = new Zend_View_Helper_Doctype(); $doctypeHelper->doctype(Engine_Api::_()->getApi('settings', 'core')->getSetting('core.doctype', 'HTML4_LOOSE')); // Add to local container and registry Zend_Registry::set('Zend_View', $view); return $view; }
/** * Simplify the datagrid creation process * @return Bvb_Grid_Deploy_Table */ public function grid($id = '') { $view = new Zend_View(); $view->setEncoding('ISO-8859-1'); $config = new Zend_Config_Ini('./application/grids/grid.ini', 'production'); $grid = Bvb_Grid::factory('Table', $config, $id); $grid->setEscapeOutput(false); $grid->setExport(array('xml', 'csv', 'excel', 'pdf')); $grid->setView($view); #$grid->saveParamsInSession(true); #$grid->setCache(array('enable' => array('form'=>false,'db'=>false), 'instance' => Zend_Registry::get('cache'), 'tag' => 'grid')); return $grid; }
/** * Configure view with UTF-8 options and ViewRenderer action helper. * The Zend_Layout component also gets initialized here. * * @return Zend_View */ protected function _initView() { $this->bootstrap(array('Configuration', 'OpusFrontController')); $config = $this->getResource('Configuration'); $theme = $config->theme; if (empty($theme)) { $theme = 'opus4'; } $layoutpath = APPLICATION_PATH . '/public/layouts/' . $theme; if (false === is_dir($layoutpath)) { throw new Exception('Requested theme "' . $theme . '" not found.'); } Zend_Layout::startMvc(array('layoutPath' => $layoutpath, 'layout' => 'common')); // Initialize view with custom encoding and global view helpers. $view = new Zend_View(); $view->setEncoding('UTF-8'); // Set doctype to XHTML1 strict $view->doctype('XHTML1_STRICT'); // Set path to Zend extension view helpers to be accessible in other // modules too. $libRealPath = realpath(APPLICATION_PATH . '/library'); $view->addHelperPath($libRealPath . '/Application/View/Helper', 'Application_View_Helper'); // Set path to shared view partials $view->addScriptPath($libRealPath . '/Application/View/Partial'); // Breadcrumbs View Helper global ersetzen $breadcrumbsHelper = new Application_View_Helper_Breadcrumbs(); $view->registerHelper($breadcrumbsHelper, 'breadcrumbs'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); // Make View available to unit test (TODO maybe there is a better way?) Zend_Registry::set('Opus_View', $view); return $view; }
protected function _initView() { $config = $this->getOption('configuration'); $view = new \Zend_View(); $view->doctype($config['view']['doctype']); $view->setEncoding($config['view']['encoding']); $view->headTitle($config['view']['title'])->setSeparator($config['view']['titleSeparator'])->setDefaultAttachOrder(\Zend_View_Helper_Placeholder_Container_Abstract::PREPEND); $view->headMeta()->setName('keywords', $config['view']['keywords'])->setName('description', $config['view']['description']); $view->addHelperPath('Pkr/View/Helper/', 'Pkr_View_Helper_'); $view->partialLoop()->setObjectKey('object'); // add it to the ViewRenderer $viewRenderer = \Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $viewRenderer->setView($view); \Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); return $view; }
/** * Test set/getEncoding() * @group ZF-8715 */ public function testSetGetEncoding() { $view = new Zend_View(); $this->assertEquals('UTF-8', $view->getEncoding()); $view->setEncoding('ISO-8859-1'); $this->assertEquals('ISO-8859-1', $view->getEncoding()); }
public function render($template, $data = array()) { $root = Zend_Registry::get('root'); // Prepare the view $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->addHelperPath("{$root}/library/Stuffpress/View/Helper", 'Stuffpress_View_Helper'); $view->setBasePath("{$root}/application/plugins/{$this->_prefix}/views"); // Add the data foreach ($data as $k => $v) { $view->{$k} = $v; } return $view->render("{$template}.phtml"); }
public static function setupView() { $view = new Zend_View(); $view->setEncoding('UTF-8'); $view->addHelperPath(self::$root . '/library/Stuffpress/View/Helper', 'Stuffpress_View_Helper'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); }
// Routes $router = $frontController->getRouter(); // Add your routes here //$router->addRoute('post', new Zend_Controller_Router_Route('post/:id', array('controller' => 'index', 'action' => 'readpost', 'id' => null), array('id'=>'\d+'))); // set up database $db = Zend_Db::factory($config->adapter, $config->database->toArray()); Zend_Db_Table::setDefaultAdapter($db); $db->query('SET NAMES ' . $config->charset); Zend_Registry::set('db', $db); // Remove the following line in production $frontController->throwExceptions(true); $frontController->setBaseUrl('/mailer/'); $frontController->addModuleDirectory('application/modules'); $view = new Zend_View(); $view->doctype('XHTML1_STRICT'); $view->setEncoding('UTF-8'); $view->baseUrl = $frontController->getBaseUrl(); // layout to be determined by the AjaxCheckPlugin, see library directory for details :) $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewRenderer); // Paginator setup Zend_Paginator::setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); // Run the dispatcher $frontController->returnResponse(true); $response = $frontController->dispatch(); // Output in UTF-8 if ($view->layout()->isEnabled()) { if ($view->layout()->getLayout() == 'common') { $response->setHeader("Content-Type", "text/html; charset=UTF-8", true); } elseif ($view->layout()->getLayout() == 'ajax') {