在Controller Codeigniter中加载控制器

时间:2014-01-20 12:00:31

标签: codeigniter

我想知道是否可以制作一个MY_Controller,让我在控制器文件中执行下面描述的操作。

就这样我可以加载这样的控制器:

<?php 

class Home extends CI_Controller {

public function index(){
$data['column_left'] = $this->load->controllers('common/column_left');
$data['column_right'] = $this->load->controllers('common/column_right');
$data['content_top'] = $this->load->controllers('common/content_top');
$data['content_bottom'] = $this->load->controllers('common/content_bottom');
$data['footer'] = $this->load->controllers('common/footer');
$data['header'] = $this->load->controllers('common/header');

if (file_exists('/template/common/home.tpl')) {
    $this->load->view('/template/common/home.tpl', $data));
} else {
    $this->load->view('default/template/common/home.tpl', $data));
}       
}

0 个答案:

没有答案