@@ 123-125 (lines=3) @@ | ||
120 | } |
|
121 | ||
122 | private function returnHtml($functionName, $request, $args, $response, $route, $action, $template){ |
|
123 | if (!file_exists($this->config['base_dir'] . $template)) { |
|
124 | throw new \Exception("<strong>Template file not found!</strong> " . $route . '/' . $action . " needs a template file at:" . $template); |
|
125 | } |
|
126 | $functionOutput = call_user_func($functionName, $request, $args); |
|
127 | if (isset($functionOutput['redirect'])) { |
|
128 | return $response->withRedirect($functionOutput['redirect']); |
|
@@ 141-144 (lines=4) @@ | ||
138 | } |
|
139 | $mainTemplate = '/' . $this->config['app_dir'] . '/templates/_' . $mainTemplateName . '.html'; |
|
140 | ||
141 | if (!file_exists($this->config['base_dir'] . $mainTemplate)) { |
|
142 | throw new \Exception("<strong>Main emplate file not found!</strong> " . $route . '/' . $action . |
|
143 | " needs a main template file at:" . $mainTemplate); |
|
144 | } |
|
145 | $appContent = $this->twig->render($mainTemplate, $functionOutput); |
|
146 | $newResponse = $response->withHeader('X-Powered-By', "reformo/rslim"); |
|
147 | $newResponse->write($appContent); |
|
@@ 171-173 (lines=3) @@ | ||
168 | $widgetContentFunc = "rwidget_" . $widgetName . "_" . $widgetAction; |
|
169 | if (function_exists($widgetContentFunc)) { |
|
170 | $widgetContent = call_user_func($widgetContentFunc, $args); |
|
171 | if (!file_exists($this->config['base_dir'] . $widgetTemplate)) { |
|
172 | throw new \Exception("<strong>Widget should return string:</strong> " . $widgetName . '/' . $widgetAction . "!"); |
|
173 | } |
|
174 | return $this->twig->render($widgetTemplate, $widgetContent); |
|
175 | } |
|
176 | throw new \Exception("<strong>Widget function not found!</strong> " . $widgetName . '/' . $widgetAction . "!"); |