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


PHP Control::getSnippetId方法代碼示例

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


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

示例1: create

 /**
  * Starts conditional snippet rendering. Returns SnippetHelper object if snippet was started.
  * @param  Control control
  * @param  string  snippet name
  * @param  string  start element
  * @return SnippetHelper
  */
 public static function create(Control $control, $name = NULL, $tag = 'div')
 {
     if (self::$outputAllowed) {
         // rendering flow or non-AJAX request
         $obj = new self();
         $obj->tag = trim($tag, '<>');
         if ($obj->tag) {
             echo '<', $obj->tag, ' id="', $control->getSnippetId($name), '">';
         }
         return $obj;
         // or string?
     } elseif ($control->isControlInvalid($name)) {
         // start snippet buffering
         $obj = new self();
         $obj->id = $control->getSnippetId($name);
         $obj->payload = $control->getPresenter()->getPayload();
         ob_start();
         $obj->level = ob_get_level();
         self::$outputAllowed = TRUE;
         return $obj;
     } else {
         return FALSE;
     }
 }
開發者ID:jaroslavlibal,項目名稱:MDW,代碼行數:31,代碼來源:SnippetHelper.php

示例2: renderSnippets

 public static function renderSnippets(Control $control, stdClass $local, array $params)
 {
     $control->snippetMode = FALSE;
     $payload = $control->getPresenter()->getPayload();
     if (isset($local->blocks)) {
         foreach ($local->blocks as $name => $function) {
             if ($name[0] !== '_' || !$control->isControlInvalid(substr($name, 1))) {
                 continue;
             }
             ob_start();
             $function = reset($function);
             $snippets = $function($local, $params);
             $payload->snippets[$id = $control->getSnippetId(substr($name, 1))] = ob_get_clean();
             if ($snippets) {
                 $payload->snippets += $snippets;
                 unset($payload->snippets[$id]);
             }
         }
     }
     $control->snippetMode = TRUE;
     if ($control instanceof IRenderable) {
         $queue = array($control);
         do {
             foreach (array_shift($queue)->getComponents() as $child) {
                 if ($child instanceof IRenderable) {
                     if ($child->isControlInvalid()) {
                         $child->snippetMode = TRUE;
                         $child->render();
                         $child->snippetMode = FALSE;
                     }
                 } elseif ($child instanceof IComponentContainer) {
                     $queue[] = $child;
                 }
             }
         } while ($queue);
     }
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:37,代碼來源:UIMacros.php


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