* Theme::render() * * Wraps the theme around the $content * * @param string $content Raw HTML content * @param bool $return (optional) Return the output? * @return void or HTML */
($content, $return = false)
| 233 | * @return void or HTML |
| 234 | */ |
| 235 | function render($content, $return = false) |
| 236 | { |
| 237 | $this->_content = $content; |
| 238 | |
| 239 | extract($this->_data); |
| 240 | |
| 241 | $theme = $this->config('path') . $this->config('theme') . '/' . $this->config('layout') . '.php'; |
| 242 | if (!file_exists($theme)) |
| 243 | { |
| 244 | show_error('Make sure you configurate your theme <small>(did you copy the <u>themes</u> folder to your root?)</small><br><br>'.$theme.' not found.'); |
| 245 | } |
| 246 | |
| 247 | ob_start(); |
| 248 | |
| 249 | include ($theme); |
| 250 | $html = ob_get_contents(); |
| 251 | |
| 252 | ob_end_clean(); |
| 253 | |
| 254 | $html = preg_replace_callback('~((href|src)\s*=\s*[\"\'])([^\"\']+)~i', array($this, '_replace_url'), $html); |
| 255 | $html = str_replace('{template_url}', $this->config('url') . $this->config('theme'), $html); |
| 256 | |
| 257 | if ($return) |
| 258 | { |
| 259 | return $html; |
| 260 | } |
| 261 | get_instance()->output->set_output($html); |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Theme::partial() |
no test coverage detected