Welcome Guest, Not a member yet? Register   Sign In
Setting final output
#1

[eluser]Madmartigan1[/eluser]
In my admin panel, there is a setting for "maintenance mode", which if enabled will "shut down" the front end site by redirecting to the base url and displaying a message. This is done via MY_Controller. Something like this:

Code:
// "Public_Controller" controls all front-end pages

class Public_Controller extends MY_Controller {

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

        if (config_item('maintenance_mode') === TRUE)
        {
            $this->output->set_output("The site is down for a bit.");

            // at this point, we want to stop execution

        }
    }
}

The problem:
The maintenance message displays as expected, but I cannot stop the rest of the controller from running - so, along with the maintenance message, the rest of the view loads as normal below it. If I call exit() or die() in the Public_Contoller construct, nothing will happen at all.

I was surprised that set_output() behaves this way. I thought it would send the final output and stop processing. I should note that I am using CI 2.0.

I'm open to another way of handling "maintenance_mode" if this can't work.

Any suggestions or insight?


Messages In This Thread
Setting final output - by El Forum - 12-27-2010, 10:39 AM
Setting final output - by El Forum - 12-27-2010, 10:48 AM
Setting final output - by El Forum - 12-27-2010, 10:51 AM
Setting final output - by El Forum - 12-27-2010, 10:58 AM
Setting final output - by El Forum - 12-27-2010, 11:15 AM
Setting final output - by El Forum - 12-27-2010, 11:25 AM
Setting final output - by El Forum - 12-27-2010, 12:29 PM
Setting final output - by El Forum - 12-27-2010, 12:35 PM
Setting final output - by El Forum - 12-27-2010, 09:47 PM
Setting final output - by El Forum - 12-28-2010, 01:00 AM
Setting final output - by El Forum - 12-28-2010, 08:15 AM
Setting final output - by El Forum - 12-28-2010, 09:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB