Skip to content

Instantly share code, notes, and snippets.

@parap
Created February 15, 2013 11:30
Show Gist options
  • Save parap/4959846 to your computer and use it in GitHub Desktop.
Save parap/4959846 to your computer and use it in GitHub Desktop.
qwewqe
protected function displayResponse()
{
// $this->
// (new EchoFormatApi())->output($this->request, $this->response);
$parser = new TemplateNameParser();
$loader = new FilesystemLoader(
array(
SYS_LAYOUTS_PATH . '/Pages/%name%.php',
SYS_LAYOUTS_PATH . '/Partial/%name%.php',
SYS_LAYOUTS_PATH . '/Widgets/%name%.php'
));
$engine = new PhpEngine($parser, $loader);
$engine->addHelpers(
array(
new \Symfony\Component\Templating\Helper\SlotsHelper(),
new \GG\Templating\Helper\LinkHelper(),
new \GG\Templating\Helper\ShopHelper(),
));
$engine->setCharset('UTF-8');
$response = new Response();
$format = $this->getFormatFromRequest();
$response->headers->set('Content-type', $this->contentTypes[$format]. "; charset=UTF-8");
$response->headers->set('Cache-Control', 'no-cache, must-revalidate');
$response->headers->set('Expires', 'Sat, 26 Jul 1997 05:00:00 GMT');
$template = $this->setupTemplateName();
$response->setContent($engine->render($template, array('input' => $this->response)));
$response->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment