本文整理汇总了PHP中Zend_View::registerHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::registerHelper方法的具体用法?PHP Zend_View::registerHelper怎么用?PHP Zend_View::registerHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::registerHelper方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createView
/**
* Creates a pre-configured view object.
*
* @return Zend_View
*/
protected function createView()
{
$view = new Zend_View();
$urlHelper = new Mol_Test_View_Helper_Url();
$view->registerHelper($urlHelper, 'url');
return $view;
}
示例2: testRegisterHelperShouldRegisterViewObjectWithHelper
/**
* @group ZF-8177
*/
public function testRegisterHelperShouldRegisterViewObjectWithHelper()
{
require_once 'Zend/View/Helper/Doctype.php';
$view = new Zend_View();
$helper = new Zend_View_Helper_Doctype();
$view->registerHelper($helper, 'doctype');
$this->assertSame($view, $helper->view);
}
示例3: _initView
/**
* 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;
}
示例4: array
set_include_path(__DIR__ . '/../library' . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace('ZFBootstrap\\');
$autoloader->setFallbackAutoloader(true);
$dropdownPages = array(array(new Zend_Navigation_Page_Uri(array('uri' => 'navheader', 'label' => 'Nav Header')), new Zend_Navigation_Page_Uri(array('label' => 'Subpage 1-1', 'uri' => '/subpage1-1')), new Zend_Navigation_Page_Uri(array('uri' => 'divider')), new Zend_Navigation_Page_Uri(array('label' => 'Subpage 1-2', 'uri' => '/subpage1-2'))), array(new Zend_Navigation_Page_Uri(array('label' => 'Subpage 2-1', 'uri' => '/subpage2-1'))));
$pages = array(new Zend_Navigation_Page_Uri(array('uri' => 'navheader', 'label' => 'Nav Header')), new Zend_Navigation_Page_Uri(array('label' => 'Page 1', 'uri' => '/page1')), new Zend_Navigation_Page_Uri(array('uri' => 'divider')), new Zend_Navigation_Page_Uri(array('label' => 'Page 2', 'uri' => '/page2')), new Zend_Navigation_Page_Uri(array('class' => 'dont-clobber-me', 'label' => 'Dropdown Trigger 1', 'pages' => $dropdownPages[0], 'uri' => '#dropdown1')), new Zend_Navigation_Page_Uri(array('label' => 'Dropdown Trigger 2', 'pages' => $dropdownPages[1], 'uri' => '#dropdown2')), new Zend_Navigation_Page_Uri(array('label' => 'Dropdown Trigger 2', 'pages' => $dropdownPages[1], 'uri' => '#dropdown2')));
$demoMenu = new Zend_Navigation(array(new Zend_Navigation_Page_Uri(array('label' => 'Root', 'pages' => $pages, 'uri' => '/'))));
///////////////////////////////////////////////////////////////////////////////
use ZFBootstrap\View\Helper\Navigation\Menu;
///////////////////////////////////////////////////////////////////////////////
// Get an instance of Zend_View and register the Twitter Bootstrap
// dropdown-compatible menu helper in place of the default.
///////////////////////////////////////////////////////////////////////////////
$view = new Zend_View();
$view->registerHelper(new Menu(), 'menu');
///////////////////////////////////////////////////////////////////////////////
?>
<html>
<head>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" />
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" />
</head>
<body>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<?php
echo $view->navigation($demoMenu)->menu()->setMinDepth(1)->setMaxDepth(-1)->setRenderParents(false)->setUlClass('nav');
?>
示例5: createView
/**
* Creates a view for testing.
*
* @return Zend_View
*/
protected function createView()
{
$view = new Zend_View();
$view->setEncoding('UTF-8');
$view->setScriptPath(dirname(__FILE__) . '/TestData');
// Simulate short_open_tag=On if necessary.
$view->setUseStreamWrapper(true);
// Register a translator for testing.
$translatorOptions = array('adapter' => 'array', 'content' => array('subjectMsgId' => 'translated'), 'locale' => 'en');
$translator = new Zend_Translate($translatorOptions);
$view->registerHelper(new Zend_View_Helper_Translate($translator), 'translate');
return $view;
}