123456789101112131415161718192021222324252627 |
- <?php
- namespace Core;
- abstract class Controller
- {
- protected $data;
- protected $controller_name;
- protected $view_name;
- protected $template_dir;
- function assign($key, $value)
- {
- $this->data[$key] = $value;
- }
- function display($file = '')
- {
- $this->template_dir = Application::getInstance()->base_dir.'/Views';
- if (empty($file))
- {
- $file = strtolower($this->controller_name).'/'.$this->view_name.'.php';
- }
- $path = $this->template_dir.'/'.$file;
- extract($this->data);
- include $path;
- }
- }
|