protected function render(array $array = null, array $globals = null) { $smarty = Smarty::getInstance(); if ($array) { $smarty->assign($array); } if ($globals) { foreach ($globals as $key => $value) { $smarty->assignGlobal($key, $value); } } $response = Sokol::getResponse(); $response->setContent(Smarty::fetchTemplate($this->getTmplName())); $response->setStatusCode(200); return $response; }
/** * Вывод контента * @param \Symfony\Component\HttpFoundation\Response $res * @param \Symfony\Component\HttpFoundation\Request $request * @param type $statusCode * @return null */ public function show(&$res = null, Request &$request, $statusCode = 200) { if (empty($res)) { return null; } if (is_object($res)) { if ($res instanceof Response) { $res->prepare($request); $res->send(); } } elseif (is_string($res)) { $response = Sokol::getResponse(); $response->setContent($res); $response->setStatusCode($statusCode); $response->prepare($request); $response->send(); } }
private function responseXml($content = null) { $response = Sokol::getResponse(); $response->headers->set('Content-Type', 'text/xml'); $response->setContent($content); $response->setStatusCode(200); return $response; }