How to use sessions on the database.php file -


what want switch between development_db , local_db. in index page, there list of databases can choose if click database name on list, whole app change specific database choose. did was, set session variable in controller read when database.php loads up, problem can't use

$this->session->read();  

on database.php file. there way database.php file can read session variables?

you can use cake's configure::write() / configure::read() in controller, access in database.php file - this:

//controller configure::write('dev', true);  //database function __construct() {     $dev = configure::read('dev');     if($dev)  $this->default = $this->dev; }  function database_config() {     $this->__construct(); } 

another option:

the other way (the way it) check $_server['dev']. set in httpd-vhosts.conf file (if using wamp):

<virtualhost mysite>     documentroot c:\wamp\www\mysite     servername mysite     setenv dev 1 </virtualhost> 

this memory, pardon if there slight issues. assume not secure method, if you're working sensitive information, more do's , dont's...etc, - works fine our non-sensitive purposes.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -