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


PHP Twig_Template::render方法代码示例

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


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

示例1: render

 /**
  * Render the current request action
  */
 public function render()
 {
     if (isset($this->controllerTemplate)) {
         if (isset($this->actionTemplate)) {
             return $this->controllerTemplate->render(['actionTemplate' => $this->actionTemplate->render([])]);
         } else {
             return $this->controllerTemplate->render([]);
         }
     } else {
         if (isset($this->actionTemplate)) {
             return $this->actionTemplate->render([]);
         }
     }
 }
开发者ID:nikolaidan,项目名称:lusoexpress,代码行数:17,代码来源:BaseController.php

示例2: populateMessage

 /**
  * Fills in message using blocks from a template (`body`, `subject`, `from`).
  * If there is no `body` block then whole template will be used.
  * If there is no `subject` or `from` block then corresponding default value will be used.
  * @param \Swift_Message $message
  * @param \Twig_Template $templateContent
  * @param array $data
  */
 protected function populateMessage(\Swift_Message $message, \Twig_Template $templateContent, $data)
 {
     $body = $templateContent->hasBlock('body') ? $templateContent->renderBlock('body', $data) : $templateContent->render($data);
     $subject = $templateContent->hasBlock('subject') ? $templateContent->renderBlock('subject', $data) : $this->defaultSubject;
     $from = $templateContent->hasBlock('from') ? $templateContent->renderBlock('from', $data) : $this->defaultFrom;
     $message->setFrom($from)->setSubject($subject)->setBody($body, 'text/html', 'utf-8');
 }
开发者ID:syzygymsu,项目名称:syzygy-framework-bundle,代码行数:15,代码来源:Composer.php

示例3: process

 /**
  * Processes the template with data to produce the final output.
  *
  * @param mixed $data The data that will be used to process the view.
  *
  * @return string Returns processed output string.
  */
 public function process($data = array())
 {
     try {
         return $this->template->render($data);
     } catch (\Exception $caught) {
         throw new ParserException("Template process error: " . $caught->getMessage(), 0, $caught);
     }
 }
开发者ID:slickframework,项目名称:template,代码行数:15,代码来源:Twig.php

示例4: compile

 /**
  * Compiles the template using the context.
  */
 public function compile()
 {
     if ($this->stopwatch) {
         $this->stopwatch->start('bolt.render', 'template');
     }
     $output = $this->template->render($this->context);
     $this->setContent($output);
     $this->compiled = true;
     if ($this->stopwatch) {
         $this->stopwatch->stop('bolt.render');
     }
 }
开发者ID:nectd,项目名称:nectd-web,代码行数:15,代码来源:BoltResponse.php

示例5: render

 /** {@inheritdoc} */
 public function render(array $context)
 {
     foreach ($context as &$var) {
         if ($var instanceof \ModelCriteria) {
             $var = new \Curry_Twig_QueryWrapper($var);
         }
         if (is_object($var) && method_exists($var, 'toTwig')) {
             $var = $var->toTwig();
         }
     }
     unset($var);
     return parent::render($context);
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:14,代码来源:Template.php

示例6: _generateNewSite

 /**
  * Turn raw files into entries
  *  
  */
 protected function _generateNewSite()
 {
     // Load templates
     $TplPost = $this->_twig->loadTemplate('post.html.twig');
     // Reiterate files
     $pages = 0;
     foreach ($this->_posts as $id => $post) {
         // Assert directory exists
         $dirName = $this->_assertDateDirectoryExists($post['depth']);
         // Open and clear file content
         $fileContent = file($this->_makeDirPath('posts/' . $post['file']));
         foreach ($fileContent as $n => $line) {
             if (isset($line[0]) && $line[0] == '@') {
                 unset($fileContent[$n]);
             } else {
                 break;
             }
         }
         $fileContent = trim(implode("\n", $fileContent));
         // Defaultise post description
         if (strlen($post['description']) == 0) {
             $post['description'] = $this->_description;
         }
         // Render template
         file_put_contents($dirName . $post['fancyName'], $this->_tplWrapper->render(array('name' => $this->_name, 'author' => $this->_author, 'title' => $post['title'], 'date' => $post['date'], 'description' => $post['description'], 'domain' => $this->_domain, 'path' => $this->_path, 'post' => $post, 'next' => isset($this->_posts[$id + 1]) ? $this->_posts[$id + 1] : false, 'previous' => isset($this->_posts[$id - 1]) ? $this->_posts[$id - 1] : false, 'page' => $TplPost->render(array('name' => $this->_name, 'author' => $this->_author, 'path' => $this->_path, 'post' => $post, 'next' => isset($this->_posts[$id + 1]) ? $this->_posts[$id + 1] : false, 'previous' => isset($this->_posts[$id - 1]) ? $this->_posts[$id - 1] : false, 'title' => $post['title'], 'description' => $post['description'], 'date' => $post['date'], 'domain' => $this->_domain, 'path' => $this->_path, 'link' => $post['link'], 'text' => $this->_parseText($fileContent))))));
         // Increase counter
         $pages++;
     }
     // Generate Index and Archive
     foreach (array('index', 'archive') as $page) {
         $TplIndex = $this->_twig->loadTemplate($page . '.html.twig');
         file_put_contents($this->_makeDirPath('site/' . $page . '.html'), $this->_tplWrapper->render(array('special' => $page, 'name' => $this->_name, 'author' => $this->_author, 'description' => $this->_description, 'domain' => $this->_domain, 'path' => $this->_path, 'page' => $TplIndex->render(array('name' => $this->_name, 'author' => $this->_author, 'description' => $this->_description, 'domain' => $this->_domain, 'path' => $this->_path, 'posts' => $this->_posts)))));
     }
     // Generate RSS
     $TplRss = $this->_twig->loadTemplate('rss.xml.twig');
     file_put_contents($this->_makeDirPath('site/rss.xml'), $TplRss->render(array('name' => $this->_name, 'author' => $this->_author, 'description' => $this->_description, 'domain' => $this->_domain, 'path' => $this->_path, 'posts' => $this->_posts, 'pubDate' => date('r', reset(array_keys($this->_posts))), 'lastBuildDate' => date('r'))));
     echo "\nWebsite containing " . ($pages == 1 ? 'one page' : $pages . ' pages') . ' has been generated!';
 }
开发者ID:rafalp,项目名称:Miblo,代码行数:42,代码来源:Application.php

示例7: render

 /**
  * @param array $context
  * @return string
  * @throws \Exception
  */
 public function render(array $context = [])
 {
     return parent::render($context);
 }
开发者ID:vvval,项目名称:spiral,代码行数:9,代码来源:TwigView.php

示例8: renderTemplate

 /**
  * {@inheritdoc}
  */
 protected function renderTemplate(array $context = array())
 {
     return $this->template->render($context);
 }
开发者ID:bonswouar,项目名称:FMElfinderBundle,代码行数:7,代码来源:FMElfinderTinymceExtensionTest.php

示例9: output

    /**
     * @param FieldDescriptionInterface $fieldDescription
     * @param \Twig_Template            $template
     * @param array                     $parameters
     *
     * @return string
     */
    public function output(FieldDescriptionInterface $fieldDescription, \Twig_Template $template, array $parameters, \Twig_Environment $environment)
    {
        $content = $template->render($parameters);
        if ($environment->isDebug()) {
            $commentTemplate = <<<EOT

<!-- START
    fieldName: %s
    template: %s
    compiled template: %s
    -->
    %s
<!-- END - fieldName: %s -->
EOT;
            return sprintf($commentTemplate, $fieldDescription->getFieldName(), $fieldDescription->getTemplate(), $template->getTemplateName(), $content, $fieldDescription->getFieldName());
        }
        return $content;
    }
开发者ID:andrey1s,项目名称:SonataAdminBundle,代码行数:25,代码来源:SonataAdminExtension.php

示例10: output

 /**
  * @param FieldDescriptionInterface $fieldDescription
  * @param \Twig_Template            $template
  * @param array                     $parameters
  *
  * @return string
  */
 public function output(FieldDescriptionInterface $fieldDescription, \Twig_Template $template, array $parameters = array())
 {
     $content = $template->render($parameters);
     if ($this->environment->isDebug()) {
         return sprintf("\n<!-- START  \n  fieldName: %s\n  template: %s\n  compiled template: %s\n -->\n%s\n<!-- END - fieldName: %s -->", $fieldDescription->getFieldName(), $fieldDescription->getTemplate(), $template->getTemplateName(), $content, $fieldDescription->getFieldName());
     }
     return $content;
 }
开发者ID:LamaDelRay,项目名称:test_symf,代码行数:15,代码来源:SonataAdminExtension.php

示例11: compile

 /**
  * Compiles the template using the context.
  */
 public function compile()
 {
     $output = $this->template->render($this->context);
     $this->setContent($output);
     $this->compiled = true;
 }
开发者ID:aleksabp,项目名称:bolt,代码行数:9,代码来源:BoltResponse.php

示例12: getContent

 /**
  * @return string
  */
 public function getContent()
 {
     return $this->Template->render($this->VariableList);
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:7,代码来源:TwigTemplate.php

示例13: renderCharacteristics

 /**
  * Renders a characteristics view table.
  *
  * @param CharacteristicsInterface $characteristics
  * @param array $options
  *
  * @return string
  */
 public function renderCharacteristics(CharacteristicsInterface $characteristics, array $options = [])
 {
     $options = array_merge(['table_class' => 'table table-striped table-bordered table-condensed ekyna-characteristics', 'highlight_inherited' => false, 'display_group' => null], $options);
     return $this->template->render(['view' => $this->manager->createView($characteristics, $options['display_group']), 'options' => $options]);
 }
开发者ID:ekyna,项目名称:characteristics,代码行数:13,代码来源:CharacteristicsExtension.php

示例14: render

 /**
  * Returns the rendered template.
  *
  * @return String
  */
 public function render()
 {
     return $this->template->render($this->parameters);
 }
开发者ID:spewia,项目名称:spewia,代码行数:9,代码来源:TwigTemplate.php


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