本文整理汇总了PHP中Zend_View_Abstract::setEncoding方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Abstract::setEncoding方法的具体用法?PHP Zend_View_Abstract::setEncoding怎么用?PHP Zend_View_Abstract::setEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Abstract
的用法示例。
在下文中一共展示了Zend_View_Abstract::setEncoding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setupView
/**
* Setup the view
*
* @param Zend_View_Abstract $view
* @param Zend_Config $config
*/
protected function _setupView(Zend_View_Abstract $view, Zend_Config $viewConfig)
{
// Add base, filter, helper and script paths
$keys = array('base', 'filter', 'helper', 'script');
foreach ($keys as $key) {
foreach ($viewConfig->get('path')->get($key) as $objKey => $obj) {
// Handle script paths
if ($key == 'script') {
$view->addScriptPath(trim($obj));
continue;
}
// Handle base, filter and helper paths
if ($obj instanceof Zend_Config || is_array($obj)) {
$path = $obj->get('path');
$prefix = $obj->get('prefix');
} else {
// Allow setting namespaces using keys
if (empty($obj)) {
$obj = $objKey;
}
$path = str_replace('_', '/', $obj);
$prefix = $obj;
}
$method = 'add' . ucfirst($key) . 'Path';
call_user_func_array(array($view, $method), array(trim($path), $prefix));
}
}
// Filters
$filters = $viewConfig->get('filter') instanceof Zend_Config ? $viewConfig->get('filter')->toArray() : array($viewConfig->get('filter'));
foreach ($filters as $filter) {
$view->addFilter($filter);
}
// Helpers
$helpers = $viewConfig->get('helper') instanceof Zend_Config ? $viewConfig->get('helper')->toArray() : array();
foreach ($helpers as $helper => $args) {
$helperName = $this->_underscoreToCamelCase($helper);
call_user_func_array(array($view, $helperName), $args);
}
// Set encoding
if ($encoding = $viewConfig->get('encoding')) {
$view->setEncoding($encoding);
}
// Set escape
if ($escape = $viewConfig->get('escape')) {
$view->setEscape($escape);
}
// Streams
if ($view instanceof Zym_View_Abstract) {
$this->_setupViewStreams($view, $viewConfig->get('stream'));
}
}