2013-12-13 60 views
0

當我檢查正在建設中的複選框,然後網站脫機,構造函數需要加載construction_view。但是,如何在under_construction = 1時停止構造函數加載索引函數?我試過退出; die()返回;但它仍然加載索引函數。是否有可能停止構造函數加載索引函數?

function __construct() 
    { 
     parent::__construct(); 
     $this->load->helper('breadcrumb'); 
     $this->load->model('Site_model'); 
     $this->footer['footer'] = $this->Site_model->get_allCategories(); 
     $this->load->vars($this->footer); 

     $construction = $this->Site_model->construction(); 
     if ($construction->under_construction == 1) { 
      $this->load->view('construction_view'); 
      exit; // die(); // return; 
     } 
    } 
function index(){ 
    $this->load->model('Site_model'); 
    $data = array(); 
    $title['title'] = 'Nordia - Home'; 
    $data['categorieInfo'] = $this->Site_model->get_allCategories(); 
    $this->load->view('head_view',$title); 
    $this->load->view('nav_view'); 
    $this->load->view('banner_view'); 
    $this->load->view('categories_view',$data); 
    $this->load->view('footer_view',$this->footer); 
} 

感謝

+1

爲什麼不把'$ construction'項目放在'index()'中,因爲它已經被調用了? – wesside

+0

Ofcourse。謝謝:-) – user2696666

+0

我會做一個「建設」的行動,並重新路由每一個請求。 –

回答

0

添加$construction項目index(),應該減輕您的問題。加載一個或另一個。

相關問題