[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?