当前位置: 首页>>代码示例>>PHP>>正文


PHP Twig_Template::displayBlock方法代码示例

本文整理汇总了PHP中Twig_Template::displayBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Twig_Template::displayBlock方法的具体用法?PHP Twig_Template::displayBlock怎么用?PHP Twig_Template::displayBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Twig_Template的用法示例。


在下文中一共展示了Twig_Template::displayBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderBlock

 /**
  * {@inheritdoc}
  */
 public function renderBlock(FormView $view, $resource, $blockName, array $variables = array())
 {
     $cacheKey = $view->vars[self::CACHE_KEY_VAR];
     $context = $this->environment->mergeGlobals($variables);
     ob_start();
     // By contract,This method can only be called after getting the resource
     // (which is passed to the method). Getting a resource for the first time
     // (with an empty cache) is guaranteed to invoke loadResourcesFromTheme(),
     // where the property $template is initialized.
     // We do not call renderBlock here to avoid too many nested level calls
     // (XDebug limits the level to 100 by default)
     $this->template->displayBlock($blockName, $context, $this->resources[$cacheKey]);
     return ob_get_clean();
 }
开发者ID:NivalM,项目名称:VacantesJannaMotors,代码行数:17,代码来源:TwigRendererEngine.php

示例2: set_lazy_block

 public function set_lazy_block(array &$context, \Twig_Template $tpl, $name, $key)
 {
     if (empty($key) || !is_string($key)) {
         throw new \Exception(sprintf("key(%s) must be string", json_encode($key)));
     }
     \Dev::shareCacheValue($key, function ($app) use(&$context, &$tpl, $name) {
         $tpl->displayBlock($name, $context);
     });
 }
开发者ID:symforce,项目名称:symforce-discuz,代码行数:9,代码来源:SymforceDiscuzTwigExtension.php

示例3: displayBlock

 public function displayBlock($name, array $context, array $blocks = array(), $useBlocks = true)
 {
     /*
     if (($this->getTemplateName() == '@Base/layout.html' || $this->getTemplateName() == '@Base/layout.json')
     	&& $name == 'content') {
     	echo \Sentinel::panel();
     }
     */
     if ($name == 'left') {
         $this->_loadBlocks(1);
     } else {
         if ($name == 'right') {
             $this->_loadBlocks(3);
             // \Phpfox::getBlock('ad.display', array('block_id' => 3));
             echo '<div id="end_right"></div>';
         } else {
             if ($name == 'content') {
                 $this->_loadBlocks(2);
             } else {
                 if ($name == 'top') {
                     $this->_loadBlocks(11);
                 }
             }
         }
     }
     $baseBlocks = ['h1', 'breadcrumb', 'top', 'content'];
     if (in_array($name, $baseBlocks)) {
         echo '<div class="_block_' . $name . '">';
     }
     parent::displayBlock($name, $context, $blocks, $useBlocks);
     if (in_array($name, $baseBlocks)) {
         echo '</div>';
     }
     if ($name == 'content') {
         $this->_loadBlocks(4);
     } else {
         if ($name == 'top') {
             $this->_loadBlocks(7);
         }
     }
 }
开发者ID:lev1976g,项目名称:core,代码行数:41,代码来源:Base.php


注:本文中的Twig_Template::displayBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。