當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_View::setEncoding方法代碼示例

本文整理匯總了PHP中Zend_View::setEncoding方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_View::setEncoding方法的具體用法?PHP Zend_View::setEncoding怎麽用?PHP Zend_View::setEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_View的用法示例。


在下文中一共展示了Zend_View::setEncoding方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _initView

 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;
 }
開發者ID:shevron,項目名稱:zend-simplecal,代碼行數:26,代碼來源:Bootstrap.php

示例2: _initView

 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'));
 }
開發者ID:pccnf,項目名稱:proj_instag,代碼行數:7,代碼來源:Bootstrap.php

示例3: testGravatar

 /**
  * @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');
     }
 }
開發者ID:robo47,項目名稱:robo47-components,代碼行數:38,代碼來源:GravatarTest.php

示例4: _sendNewCommentEmail

 /**
  * 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);
 }
開發者ID:shevron,項目名稱:HumanHelp,代碼行數:36,代碼來源:IndexController.php

示例5: _initView

 protected function _initView()
 {
     $view = new Zend_View();
     // snip...
     $view->setEncoding('win-1251');
     // snip...
     return $view;
 }
開發者ID:xent1986,項目名稱:ychebgit,代碼行數:8,代碼來源:Bootstrap.php

示例6: setupView

 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);
 }
開發者ID:uester,項目名稱:escolaonline,代碼行數:8,代碼來源:Bootstrap.php

示例7: _initView

 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);
 }
開發者ID:rocknoon,項目名稱:Stack,代碼行數:9,代碼來源:Bootstrap.php

示例8: _initView

 protected function _initView()
 {
     ini_set('default_charset', 'UTF-8');
     $view = new Zend_View();
     // snip...
     $view->setEncoding('utf-8');
     // snip...
     return $view;
 }
開發者ID:andrelsguerra,項目名稱:pequiambiental,代碼行數:9,代碼來源:Bootstrap.php

示例9: setupView

 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'));
 }
開發者ID:aliinfotech,項目名稱:netefct,代碼行數:10,代碼來源:Bootstrap.php

示例10: _initView

 /**
  *   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;
 }
開發者ID:jaakkop,項目名稱:site,代碼行數:14,代碼來源:Bootstrap.php

示例11: _initView

 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);
 }
開發者ID:RealTimeApps,項目名稱:chargify-sample-app,代碼行數:11,代碼來源:Bootstrap.php

示例12: render

 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);
     }
 }
開發者ID:kreativmind,項目名稱:storytlr,代碼行數:13,代碼來源:PageForm.php

示例13: _initView

 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);
 }
開發者ID:rdallasgray,項目名稱:bbx,代碼行數:14,代碼來源:ContextDependencies.php

示例14: _initView

 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;
 }
開發者ID:neekfenwick,項目名稱:dojo-sandbox,代碼行數:14,代碼來源:Bootstrap.php

示例15: initView

 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;
 }
開發者ID:bersace,項目名稱:strass,代碼行數:16,代碼來源:Action.php


注:本文中的Zend_View::setEncoding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。