本文整理汇总了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;
}
示例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'));
}
示例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');
}
}
示例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);
}
示例5: _initView
protected function _initView()
{
$view = new Zend_View();
// snip...
$view->setEncoding('win-1251');
// snip...
return $view;
}
示例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);
}
示例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);
}
示例8: _initView
protected function _initView()
{
ini_set('default_charset', 'UTF-8');
$view = new Zend_View();
// snip...
$view->setEncoding('utf-8');
// snip...
return $view;
}
示例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'));
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}