Контроллер маршрутизации перенаправления Codeigniter

В моем файле rout.php в codeigniter я настроил его так, что если для моего элемента конфигурации установлено значение true, он будет использоваться по умолчанию в качестве контроллера.

$config['maintenance'] = TRUE;

route.php

if (!$this->config->item('installed')) {

$route['default_controller'] = "install/step_1/index";
$route['404_override'] = '';

} else {

if ($this->config->item('maintenance') == TRUE) {
$route['default_controller'] = "catalog/common/maintenance/index";
$route['404_override'] = '';
} else {
$route['default_controller'] = "catalog/common/home/index";
$route['404_override'] = '';
}
}

У меня проблема в том, что Когда он установлен в TRUE Когда я вошел как администратор, я все еще хотел бы, чтобы домашний контроллер был контроллером по умолчанию. Я не могу заставить его работать.

Контроллер технического обслуживания.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Maintenance extends MX_Controller {

function __construct() {
parent::__construct();
}

public function index() {

if ($this->config->item('maintenance')) {

$this->load->library('user');

if(!$this->user->isLogged()) {
$this->info();
} else {

// Should Allow Me To View Home Controller
}

}}

public function info() {
if (file_exists(DIR_TEMPLATE . $this->configs->get('config_template') . '/template/common/maintenance.php')) {
return $this->load->view($this->configs->get('config_template') . '/template/common/maintenance');
} else {
return $this->load->view('default/template/common/maintenance');
}
}

}

0

Решение

Я загрузил этот модуль hmvc $ this-> load-> и он, кажется, работает

public function index() {

if ($this->config->item('maintenance')) {

$this->load->library('user');

if(!$this->user->isLogged()) {

$this->info();

} else {

$this->load->module('catalog/common/home');
$this->home->index();

}

}}
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector