* Theme::partial() * * Loads the view just as CI except this function will look * first into the theme's subdir 'views' to find the view * * @param string $view The view to load * @param array $data The data array to pass to the view * @param bool $return (optional) Return the output? * @return void or the HTML */
($view, $data = array(), $return = false)
| 273 | * @return void or the HTML |
| 274 | */ |
| 275 | function partial($view, $data = array(), $return = false) |
| 276 | { |
| 277 | $data = is_array($data) ? $data : array(); |
| 278 | $data = array_merge($this->_data, $data); |
| 279 | |
| 280 | $path = $this->config('path') . $this->config('theme') . '/views/' . $view . '.php'; |
| 281 | if (file_exists($path)) |
| 282 | { |
| 283 | extract($data); |
| 284 | ob_start(); |
| 285 | include ($path); |
| 286 | $output = ob_get_contents(); |
| 287 | ob_end_clean(); |
| 288 | } |
| 289 | else |
| 290 | { |
| 291 | $output = get_instance()->load->view($view, $data, TRUE); |
| 292 | } |
| 293 | |
| 294 | if ($return) |
| 295 | { |
| 296 | return $output; |
| 297 | } |
| 298 | |
| 299 | echo $output; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Theme::_replace_url() |