我试图从笨像这样的应用程序文件夹(3.1.0)外加载一个观点:Codeigniter从外部应用程序文件夹加载视图?
public function index ($page = '') {
/**
* Get active theme from DB
*/
$active_theme = $this->m->getActiveTheme();
/**
* Change default view path
*/
$this->_ci_view_paths = array(
FCPATH . 'themes/' . $active_theme . '/' => TRUE
);
/**
* Load index if page is not found
*/
if (! file_exists(FCPATH . 'themes/' . $active_theme . '/' . $page . '.php')) {
$this->load->view('index', $data);
} else {
$this->load->view($page, $data);
}
}
但我发现了这个错误:
无法加载请求的文件:index.php
或我尝试加载的任何页面。
任何人都知道我在这里失踪?
为什么有文件在视图文件夹之外?为什么不包含它而不是加载它? – Brad
将前端与后端分开。这样我可以将CI交换为任何其他后端。 – blaasvaer