當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_View::addFilterPath方法代碼示例

本文整理匯總了PHP中Zend_View::addFilterPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_View::addFilterPath方法的具體用法?PHP Zend_View::addFilterPath怎麽用?PHP Zend_View::addFilterPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_View的用法示例。


在下文中一共展示了Zend_View::addFilterPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetFilters

 public function testGetFilters()
 {
     $base = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR;
     $view = new Zend_View();
     $view->setScriptPath($base . '_templates');
     $view->addFilterPath($base . '_stubs' . DIRECTORY_SEPARATOR . 'FilterDir1');
     $view->addFilter('foo');
     $filters = $view->getFilters();
     $this->assertEquals(1, count($filters));
     $this->assertEquals('foo', $filters[0]);
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:11,代碼來源:ViewTest.php

示例2: 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(dirname(__FILE__))) . '/' . $prefix . '/Views/';
         $view->addScriptPath($viewdir . 'Scripts');
         $view->addFilterPath($viewdir . 'Filters', $prefix . '_View_Filter_');
         $view->addHelperPath($viewdir . 'Helpers', $prefix . '_View_Helper_');
     }
     return $view;
 }
開發者ID:bersace,項目名稱:strass,代碼行數:15,代碼來源:Action.php

示例3: testFilterPathWithPrefix

 public function testFilterPathWithPrefix()
 {
     $view = new Zend_View();
     $status = $view->addFilterPath(dirname(__FILE__) . '/View/_stubs/HelperDir1/', 'My_View_Filter');
     $this->assertSame($view, $status);
     $filterPaths = $view->getFilterPaths();
     $path = $filterPaths[0];
     $this->assertEquals('My_View_Filter_', $path['prefix']);
     $this->assertEquals($this->normalizePath(dirname(__FILE__) . '/View/_stubs/HelperDir1/'), $path['dir']);
     $view->setFilterPath(dirname(__FILE__) . '/View/_stubs/HelperDir2/', 'Other_View_Filter');
     $filterPaths = $view->getFilterPaths();
     $path = $filterPaths[0];
     $this->assertEquals('Other_View_Filter_', $path['prefix']);
     $this->assertEquals($this->normalizePath(dirname(__FILE__) . '/View/_stubs/HelperDir2/'), $path['dir']);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:15,代碼來源:ViewTest.php

示例4: _initView

 /**
  * Initialize the view
  *
  * @return Zend_View
  */
 protected function _initView()
 {
     // Initialize view
     $view = new Zend_View();
     $this->bootstrap('siteSettings');
     // Get settings resource
     $settings = $this->getResource('siteSettings');
     // Set doctype and charset
     $view->doctype($settings->get('doc_type'));
     $view->placeholder('charset')->set($settings->get('default_charset'));
     $view->addFilterPath('Digitalus/View/Filter', 'Digitalus_View_Filter');
     $view->setFilter('Translate');
     // Add the view to the ViewRenderer
     $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
     $viewRenderer->setView($view);
     // base helpers
     $view->addHelperPath('Digitalus/View/Helper', 'Digitalus_View_Helper');
     $view->addHelperPath('Digitalus/Content/Control', 'Digitalus_Content_Control');
     // Load digitalus helpers
     $helperDirs = Digitalus_Filesystem_Dir::getDirectories(BASE_PATH . '/library/Digitalus/View/Helper');
     if (is_array($helperDirs)) {
         foreach ($helperDirs as $dir) {
             $view->addHelperPath(BASE_PATH . '/library/Digitalus/View/Helper/' . $dir, 'Digitalus_View_Helper_' . ucfirst($dir));
         }
     }
     $view->baseUrl = $this->_front->getBaseUrl();
     // Return it, so that it can be stored by the bootstrap
     return $view;
 }
開發者ID:laiello,項目名稱:digitalus-cms,代碼行數:34,代碼來源:Bootstrap.php


注:本文中的Zend_View::addFilterPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。