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


PHP ModelInterface::getTemplate方法代碼示例

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


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

示例1: render

 /**
  * Processes a view script and returns the output.
  *
  * @param  string|ModelInterface   $nameOrModel The script/resource process, or a view model
  * @param  null|array|\ArrayAccess $values      Values to use during rendering
  * @return string The script output.
  * @throws \LogicException
  */
 public function render($nameOrModel, $values = null)
 {
     $name = $nameOrModel;
     if ($nameOrModel instanceof ModelInterface) {
         $name = $this->resolver->resolve($nameOrModel->getTemplate(), $this);
         $values = (array) $nameOrModel->getVariables();
     }
     if (array_key_exists('helper', $values)) {
         throw new \LogicException('Variable $helper is reserved for Zend helpers and can\'t be passed to view.');
     }
     $values['helper'] = $this->helpers;
     return $this->engine->renderToString($name, $values);
 }
開發者ID:halaxa,項目名稱:zf2-latte,代碼行數:21,代碼來源:LatteRenderer.php

示例2: searchTemplates

 /**
  * Recursively search a view model and it's children for the given templateName
  *
  * @param  \Zend\View\Model\ModelInterface $viewModel
  * @param  string    $templateName
  * @return boolean
  */
 protected function searchTemplates($viewModel, $templateName)
 {
     if ($viewModel->getTemplate($templateName) == $templateName) {
         return true;
     }
     foreach ($viewModel->getChildren() as $child) {
         return $this->searchTemplates($child, $templateName);
     }
     return false;
 }
開發者ID:CHRISTOPHERVANDOMME,項目名稱:zf2complet,代碼行數:17,代碼來源:AbstractControllerTestCase.php

示例3: wrapBlock

 /**
  * assign wrapper template to block
  *
  * @param ModelInterface $block
  * @param array|string $options
  */
 protected function wrapBlock(ModelInterface $block, $options)
 {
     $attributes = $options;
     if (is_string($options)) {
         $wrapperTemplate = $options;
         $attributes = [];
     } elseif (is_array($options) && !isset($options['template'])) {
         $wrapperTemplate = self::WRAPPER_DEFAULT;
     } else {
         $wrapperTemplate = $options['template'];
         unset($attributes['template']);
     }
     if (isset($options['tag'])) {
         $block->setVariable('wrapperTag', $options['tag']);
         unset($attributes['tag']);
     }
     $originalTemplate = $block->getTemplate();
     $block->setOption('is_wrapped', true);
     $block->setTemplate($wrapperTemplate);
     $block->setVariable('wrapperAttributes', $attributes);
     $block->setVariable('originalTemplate', $originalTemplate);
 }
開發者ID:adamdyson,項目名稱:ConLayout,代碼行數:28,代碼來源:BlockFactory.php


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