• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Switching the enviroment

I am trying to make an application that will sometimes need to run offline using a local database.
The way I'm envisioning this is if the users click a button that says "switch to offline mode" then the application will change things, Certain features will be disabled, the database will change from the webserver to localhost. I can already do the changes within the application by switching the enviroment manually from production to offline in the index.php file. is there a way to change this from within the app?


You can achieve this by setting different flags within your config\database config and config\config

For instance you could have if(!$config['offlineMode']){connect to this database else connect to offline database} and do the same for your base_url
How you detect for this is up to you, either set this manually yourself in the config $config['offlineMode'] = true';
Write to a blank config file, so for instance in your admin panel if set to true then write to that file
Or a database call that checks what mode the site is in

Hope that helps

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.