本文整理汇总了PHP中Zend_View::getHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::getHelper方法的具体用法?PHP Zend_View::getHelper怎么用?PHP Zend_View::getHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::getHelper方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHelperUsesServerAndBaseUrlFromHelpersByDefault
public function testHelperUsesServerAndBaseUrlFromHelpersByDefault()
{
$base = $this->view->getHelper('baseUrl');
$base->setBaseUrl('/foo/bar');
$server = $this->view->getHelper('serverUrl');
$server->setScheme('https')->setHost('example.com:8080');
$test = $this->helper->getBaseUrl();
$this->assertEquals('https://example.com:8080/foo/bar/', $test);
}
示例2: testDatePickerOptionsAreRenderedInJavascript
public function testDatePickerOptionsAreRenderedInJavascript()
{
$options = array('foo' => uniqid());
$this->_picker->setDatePickerOptions($options);
// render the element
$this->_picker->render($this->_view);
/** @var $jq ZendX_JQuery_View_Helper_JQuery_Container */
$jq = $this->_view->getHelper('jQuery');
// test for date picker customization
$this->assertContains("\$('#{$this->_picker->getId()}').datepicker", implode('', $jq->getOnLoadActions()), 'DatePicker should be initialized by id');
$this->assertContains(Zend_Json::encode($options), implode('', $jq->getOnLoadActions()), 'DatePicker should be initialized with custom options');
}
示例3: init
public function init()
{
parent::init();
$this->view->getHelper('headTitle')->headTitle('VAR_BASE_TITLE');
$this->view->getHelper('HeadMeta')->appendHttpEquiv('pragma', 'no-cache')->appendHttpEquiv('Cache-Control', 'no-cache')->appendHttpEquiv('Content-Type', 'application/xhtml+xml; charset=UTF-8')->appendHttpEquiv('Content-Language', 'pl-PL');
// /->appendName('author', '');
$this->view->getHelper('Doctype')->setDoctype(Zend_View_Helper_Doctype::XHTML11);
$this->messages = Dfi_Controller_Action_Helper_Messages::getInstance();
Zend_Controller_Action_HelperBroker::addHelper($this->messages);
Zend_Auth::getInstance()->setStorage(new Dfi_Auth_Storage_Cookie('VAR_user'));
/* $this->messages->addMessage(Dfi_Controller_Action_Helper_Messages::TYPE_DEBUG, 'test - DEBUG');
$this->messages->addMessage('error', 'test');
$this->messages->addMessage('confirmation', 'test');
$this->messages->addMessage('notice', 'test');*/
$this->view->addHelperPath('View/Helper', 'View_Helper');
$this->view->addBasePath(APPLICATION_PATH . 'views/partials/');
}
示例4: testBaseUrlUsedForFileLinks
/**
* Regression Test fuer OPUSVIER-3192.
*/
public function testBaseUrlUsedForFileLinks()
{
$helper = new Application_View_Helper_FileLink();
$view = new Zend_View();
$view->getHelper('BaseUrl')->setBaseUrl('/testbase');
$helper->setView($view);
$file = new Opus_File(126);
$this->assertEquals('<a href="http:///testbase/files/146/test.pdf">foo-pdf</a>' . '<input type="hidden" name="" value="126" id="" />', $helper->fileLink(null, $file, array('useFileLabel' => true)));
}
示例5: testRegisterHelperShouldRegisterHelperWithView
/**
* @group ZF-8177
*/
public function testRegisterHelperShouldRegisterHelperWithView()
{
require_once dirname(__FILE__) . '/View/_stubs/HelperDir1/Stub1.php';
$view = new Zend_View();
$helper = new Foo_View_Helper_Stub1();
$view->registerHelper($helper, 'stub1');
$this->assertEquals($view->getHelper('stub1'), $helper);
$this->assertEquals($view->stub1(), 'foo');
}
示例6: testGetHelperUsingDifferentCasesReturnsSameInstance
public function testGetHelperUsingDifferentCasesReturnsSameInstance()
{
$view = new Zend_View();
$helper1 = $view->getHelper('formHidden');
$helper2 = $view->getHelper('FormHidden');
$this->assertSame($helper1, $helper2);
}
示例7: testGetHelperWorksWithPredefinedClassNames
/**
* @issue ZF-2742
*/
public function testGetHelperWorksWithPredefinedClassNames()
{
$view = new Zend_View();
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir2');
try {
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir1', null);
$this->fail('Exception for empty prefix was expected.');
} catch (Exception $e) {
$this->assertContains('only takes strings', $e->getMessage());
}
try {
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir1', null);
$this->fail('Exception for empty prefix was expected.');
} catch (Exception $e) {
$this->assertContains('only takes strings', $e->getMessage());
}
try {
$helper = $view->getHelper('Datetime');
} catch (Exception $e) {
$this->assertContains('not found', $e->getMessage());
}
}
示例8: testGetHelper
public function testGetHelper()
{
// require so we can do type hinting
require_once 'Zend/View/Helper/DeclareVars.php';
$view = new Zend_View();
$view->declareVars();
$helper = $view->getHelper('declareVars');
$this->assertTrue($helper instanceof Zend_View_Helper_DeclareVars);
}
示例9: testGetHelperWorksWithPredefinedClassNames
/**
* @issue ZF-2742
*/
public function testGetHelperWorksWithPredefinedClassNames()
{
$view = new Zend_View();
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir2');
try {
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir1', null);
$this->fail('Exception for empty prefix was expected.');
} catch (Exception $e) {
$this->assertEquals('The classPrefix cannot be empty.', $e->getMessage());
}
try {
$view->setHelperPath(dirname(__FILE__) . '/View/_stubs/HelperDir1', null);
$this->fail('Exception for empty prefix was expected.');
} catch (Exception $e) {
$this->assertEquals('The classPrefix cannot be empty.', $e->getMessage());
}
$helper = $view->getHelper('Datetime');
$this->assertEquals('Zend_View_Helper_Datetime', get_class($helper));
}
示例10: getHelper
/**
* Returns the mocked url helper.
*
* @return Mol_Test_View_Helper_Url
*/
private function getHelper()
{
return $this->view->getHelper('Url');
}