Welcome Guest, Not a member yet? Register   Sign In
How would you create a Site On/Off button?
#2

[eluser]umefarooq[/eluser]
if you are saving settings in database create a field offline to make site offline set value 1 for offline or 0 to online or as you want and also one field for message, now create a Public controller extends your MY_Contoller in that public controller's constructor check site is online or not if it offline then show error with your error message from data and extend your all public controllers with that your all public controller will be offline not the admin

Code:
class Public_controller extends MY_Controller{

function Publich_controller(){
  parent::MY_Controller();
   $row = $this->db->select('offline,message')->get('settings')->row();
  if($row->offline)
   show_error($row->message);

}

}

class welcome extends Publich_controller{

  function welcome(){
   parent::Publich_controller();
}

function index(){
  $this->load->view('welcome_messge');
}
}

always you public controller constructor will be called first and it will check the settings value


Messages In This Thread
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 12:27 AM
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 02:03 AM
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 02:04 AM
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 02:45 AM
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 10:35 AM
How would you create a Site On/Off button? - by El Forum - 02-22-2010, 10:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB