Deprecation: Deprecated since 3.3, use TemplateResponse instead.
Author: Ross Riley (riley.ross@gmail.com)
Inheritance: extends Symfony\Component\HttpFoundation\Response
示例#1
0
文件: Render.php 项目: aleksabp/bolt
 /**
  * Render a template, possibly store it in cache. Or, if applicable, return the cached result.
  *
  * @param string $template the template name
  * @param array  $vars     array of context variables
  * @param array  $globals  array of global variables
  *
  * @return mixed
  */
 public function render($template, $vars = array(), $globals = array())
 {
     // Start the 'stopwatch' for the profiler.
     $this->app['stopwatch']->start('bolt.render', 'template');
     $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals);
     // Stop the 'stopwatch' for the profiler.
     $this->app['stopwatch']->stop('bolt.render');
     return $response;
 }
示例#2
0
文件: Render.php 项目: youprofit/bolt
 /**
  * Render a template, possibly store it in cache. Or, if applicable, return the cached result.
  *
  * @param string $template the template name
  * @param array  $vars     array of context variables
  * @param array  $globals  array of global variables
  *
  * @return \Bolt\Response\BoltResponse
  */
 public function render($template, $vars = [], $globals = [])
 {
     $response = BoltResponse::create($this->app[$this->twigKey]->loadTemplate($template), $vars, $globals);
     $response->setStopwatch($this->app['stopwatch']);
     return $response;
 }
示例#3
0
 public function testGetTemplateName()
 {
     $app = $this->getApp();
     $response = BoltResponse::create($app['twig']->loadTemplate('error.twig'), []);
     $this->assertEquals('error.twig', $response->getTemplateName());
 }