本文整理汇总了PHP中Zend_View::setHelperPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::setHelperPath方法的具体用法?PHP Zend_View::setHelperPath怎么用?PHP Zend_View::setHelperPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::setHelperPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initView
public function _initView()
{
// Initialize view
$view = new Zend_View();
// Setup Helper Paths
$view->setHelperPath(SM_LIB . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . 'Helper', 'Smallunch_lib_View_Helper');
// Add Global Helper path (typically application/helpers
$view->addHelperPath(GLOBAL_HELPER_DIR . DIRECTORY_SEPARATOR . 'View');
// add per application helper path (typically application/(backend, frontend)/helpers
$view->addHelperPath(APPLICATION_DIRECTORY . DIRECTORY_SEPARATOR . 'Helper' . DIRECTORY_SEPARATOR . 'View');
// Setup layout
if (isset($this->config->layout->doctype)) {
$view->doctype($this->config->layout->doctype);
}
if (isset($this->config->default->title)) {
$view->headTitle($this->config->default->title);
}
if (isset($this->config->default->meta_keywords)) {
$view->headMeta($this->config->default->meta_keywords, 'keywords');
}
if (isset($this->config->default->meta_description)) {
$view->headMeta($this->config->default->meta_description, 'description');
}
if (isset($this->config->layout->charset)) {
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=' . $this->config->layout->charset);
}
if (isset($this->config->layout->content_language)) {
$view->headMeta()->appendHttpEquiv('Content-Language', $this->config->layout->content_language);
}
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
示例2: render
public function render($datas)
{
$this->_scriptName = $datas->scriptName;
# html mail
// needed: email, passwd, scriptname
$file = APPLICATION_PATH . '/configs/langs/' . $datas->lang . '/emails.ini';
$texts = new Zend_Config_Ini($file, $this->_scriptName);
$view = new Zend_View();
$view->setScriptPath($this->_config->mail->scriptsPath);
$view->setHelperPath($this->_config->mail->helpersPath);
// switch sur la lang pour header
switch ($datas->lang) {
case 'befl':
case 'befr':
case 'nl':
$view->top = 'top_challenge.jpg';
break;
default:
$view->top = 'top.jpg';
break;
}
$view->texts = $texts;
$view->assign((array) $datas->view);
$view->webhost = $this->_config->site->webhost;
$view->tplname = $this->_scriptName;
// on gere le setFrom ici car localisé
$this->setFrom($this->_config->mail->addressFrom, $texts->labelFrom);
$this->_document = $view->render($this->_scriptName . '.phtml');
$this->setSubject(utf8_decode($texts->subject));
$this->setBodyHtml($this->_document, 'utf-8');
$this->addTo($datas->view->email);
$this->send();
}
示例3: getView
public function getView()
{
if (null === $this->_view) {
$options = $this->getOptions();
$title = '';
$doctype = '';
$contentType = 'text/html; charset=iso-8859-1';
if (array_key_exists('title', $options)) {
$title = $options['title'];
unset($options['title']);
}
if (isset($options['doctype'])) {
$doctype = $options['doctype'];
unset($options['doctype']);
}
if (isset($options['content-type'])) {
$contentType = $options['content-type'];
unset($options['content-type']);
}
$view = new Zend_View($options);
$view->doctype($doctype);
$view->headTitle($title);
$view->headMeta()->setHttpEquiv('content-type', $contentType);
$view->setHelperPath(LIBRARY_PATH . DS . 'Webbers/View/Helper', 'Webbers_View_Helper');
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setViewSuffix('inc');
$viewRenderer->setView($view);
$this->_view = $view;
}
return $this->_view;
}
示例4: __construct
public function __construct($options, $seotoasterData)
{
// setting up Seotoaster data and plugin options
$this->_options = $options;
$this->_seotoasterData = $seotoasterData;
// setting up helpers
$this->_sessionHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('session');
$this->_websiteHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('website');
$this->_responseHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('response');
$this->_redirector = new Zend_Controller_Action_Helper_Redirector();
// setting up request and response objects
$front = Zend_Controller_Front::getInstance();
$this->_request = $front->getRequest();
$this->_response = $front->getResponse();
unset($front);
// setting up view
$this->_view = new Zend_View();
$this->_websiteUrl = $this->_websiteHelper->getUrl();
$this->_pluginName = strtolower(__CLASS__);
$this->_view->websiteUrl = $this->_websiteUrl;
$this->_view->pluginName = $this->_pluginName;
// setting up view helpers (standart and ZendX)
$this->_view->setHelperPath(APPLICATION_PATH . '/views/helpers/');
$this->_view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
// runing init routines
$this->_initAcl();
$this->_initTranslator();
$this->_init();
}
示例5: 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'));
}
示例6: _initView
protected function _initView()
{
$view = new Zend_View();
$view->doctype('HTML5');
$view->headTitle()->setSeparator(' | ');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8');
$view->setHelperPath(APPLICATION_PATH . '/modules/admin/views/helpers/');
$view->addHelperPath(APPLICATION_PATH . '/modules/public/views/helpers/');
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->setView($view);
}
示例7: RenderApplet
/**
* comments
*/
public function RenderApplet($applet)
{
$config = Zend_Registry::get('config');
//create a new instance of view
$appletView = new Zend_View();
$appletView->setScriptPath($config->view->applet->path . '/' . $applet);
$appletView->setHelperPath($config->view->applet->path . '/' . $applet, 'Digitalus_Applet');
//tell the applet about where it is
$appletView->page = $this->view->page;
$appletView->pageObj = $this->view->pageObj;
//run the code behind
if (file_exists($config->view->applet->path . '/' . $applet . '/' . $applet . '.php')) {
$appletView->{$applet}();
}
return $appletView->render($applet . '.phtml');
}
示例8: _render
/**
* @desc create each mail object and send it to user
* @param object $datas
* @return void
*/
private function _render($datas)
{
$this->mail = new Zend_Mail('UTF-8');
$view = new Zend_View();
$view->setScriptPath($this->_config->mail->scriptsPath);
$view->setHelperPath($this->_config->mail->helpersPath);
$view->tplname = $this->_scriptName;
$lang = $datas->lang;
$view->texts = $this->_texts->{$lang};
// switch sur la lang pour header
switch ($datas->lang) {
case 'befl':
case 'befr':
case 'nl':
$view->top = 'top_challenge.jpg';
break;
default:
$view->top = 'top.jpg';
break;
}
// selection de la video si template youtube
if ($this->_scriptName == 'youtube') {
if ($this->_day) {
$view->urlVideo = $view->texts->{video . $this->_day};
$view->day = $this->_day;
} else {
$day = Zend_Registry::get('week');
$video = 'video' . $day;
$view->urlVideo = $view->texts->{$video};
$view->day = $day;
}
}
$view->assign((array) $datas);
$view->webhost = $this->_config->site->webhost;
$this->_document = $view->render($this->_scriptName . '.phtml');
$this->mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
// $this->mail->setSubject(utf8_decode($view->texts->subject));
$this->mail->setSubject($view->texts->subject);
$this->mail->setBodyHtml($this->_document);
$this->mail->addTo($datas->email, $datas->firstName);
$this->mail->send();
}
示例9: _initViewHelpers
/**
* Add view Helpers
*/
protected function _initViewHelpers()
{
$view = new Zend_View();
/**
* set helper Path
*/
$view->setHelperPath(APPLICATION_PATH . '/helpers', '');
/**
* add jQuery helper path
*/
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
/**
* add $view to the view renderer
*/
$viewRenderer->setView($view);
/**
* add viewRenderer to ActionHelper
*/
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $view;
}
示例10: testGetHelperWorksWithPredefinedClassNames
/**
* @group 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());
}
}
示例11: testLoadHelperNonexistantClass
/**
* Tests that calling a helper whose file exists but class is not found within
* throws the expected exception
*/
public function testLoadHelperNonexistantClass()
{
$view = new Zend_View();
$view->setHelperPath(array(dirname(__FILE__) . '/View/_stubs/HelperDir1'));
try {
// attempt to load the helper StubEmpty, whose file exists but
// does not contain the expected class within
$view->stubEmpty();
// @todo: fail if no exception?
} catch (Zend_View_Exception $e) {
$this->assertRegexp("/['_a-z]+ not found in path/i", $e->getMessage());
}
}
示例12: 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));
}
示例13: array
require_once 'Zend/Config/Ini.php';
require_once 'Zend/View.php';
require_once 'Zend/Locale.php';
require_once 'Zend/Controller/Action/HelperBroker.php';
require_once 'Zend/Translate.php';
require_once 'Zend/Registry.php';
$i18nConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/i18n.ini', APPLICATION_ENV);
$appConfig = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
// --- VIEW
// Initialize view
$view = new Zend_View();
$view->env = APPLICATION_ENV;
$view->setHelperPath(APPLICATION_PATH . '/layouts/helpers');
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
// Language mapping ExtJS -> Zend
$langMapping = array(
"en_US" => "ext-lang-en.js",
"de_DE" => "ext-lang-de.js"
);
// --- TRANSLATE
示例14: _initView
/**
* Initialises the view renderer.
*
* @return Zend_View view renderer
*/
protected function _initView()
{
/* Create the view. */
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->setHelperPath(self::$rootDirectory . '/views/helpers');
/* Add it to the view renderer. */
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
Zend_Layout::startMvc(array('layoutPath' => self::$rootDirectory . '/views/layouts'));
return $view;
}
示例15: testLoadHelperNonexistantClass
/**
* Tests that calling a helper whose file exists but class is not found within
* throws the expected exception
*/
public function testLoadHelperNonexistantClass()
{
$view = new Zend_View();
$view->setHelperPath(array(dirname(__FILE__) . '/_stubs/HelperDir1'));
try {
// attempt to load the helper StubEmpty, whose file exists but
// does not contain the expected class within
$view->stubEmpty();
} catch (Zend_View_Exception $e) {
$this->assertRegexp('/loaded but class [\'_A-z]+ not found/i', $e->getMessage());
}
}