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


PHP Zend_View_Abstract::getHelper方法代碼示例

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


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

示例1: array

 function _compile_compiler_tag($tagCommand, $tagArgs, &$output)
 {
     //We first try to use Smarty's own functionality to parse the tag
     $found = parent::_compile_compiler_tag($tagCommand, $tagArgs, $output);
     if ($found === false) {
         try {
             //Check if helper exists and create output
             $this->zendView->getHelper($tagCommand);
             $helperArgs = array();
             if ($tagArgs !== null) {
                 //Start parsing our custom syntax
                 $params = explode(' ', $tagArgs);
                 foreach ($params as $p) {
                     //Split each key=value pair to vars
                     list($key, $value) = explode('=', $p, 2);
                     $section = '';
                     //If there's a dot in the key, it means we
                     //need to use associative arrays
                     if (strpos('.', $key) != -1) {
                         list($key, $section) = explode('.', $key);
                     }
                     //Use Smarty's own functions to parse the value
                     //so that if there's a variable, it gets changed to
                     //properly point at a template variable etc.
                     $value = $this->_parse_var_props($value);
                     //Put the value into the arg array
                     if ($section == '') {
                         if (array_key_exists($key, $helperArgs)) {
                             if (is_array($helperArgs[$key])) {
                                 $helperArgs[$key][] = $value;
                             } else {
                                 $helperArgs[$key] = array($helperArgs[$key], $value);
                             }
                         } else {
                             $helperArgs[$key] = $value;
                         }
                     } else {
                         if (!is_array($helperArgs[$key])) {
                             $helperArgs[$key] = array();
                         }
                         $helperArgs[$key][$section] = $value;
                     }
                 }
             }
             //Save the code to put to the template in the output
             $output = "<?php echo \$this->callViewHelper('{$tagCommand}',array(" . $this->_createParameterCode($helperArgs) . ")); ?>";
             $found = true;
         } catch (Exception $e) {
             //Exception means the helper was not found
             $found = false;
             fwrite(fopen('php://stderr', 'a'), $e->getMessage());
         }
     }
     return $found;
 }
開發者ID:Eximagen,項目名稱:sochi,代碼行數:55,代碼來源:ProjectSmartyCompiler.php

示例2: callViewHelper

 /**
  * @param string $name
  * @param mixed $args
  * @return mixed The helper return
  */
 public function callViewHelper($name, $args)
 {
     $helper = $this->zendView->getHelper($name);
     return call_user_func_array(array($helper, $name), $args);
 }
開發者ID:Eximagen,項目名稱:sochi,代碼行數:10,代碼來源:ProjectSmarty.php


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