Welcome Guest, Not a member yet? Register   Sign In
how to: conditonal config
#2

i think the best way to achieve what you want is a hook - below an example

in your application/config/hooks.php

PHP Code:
$hook['pre_controller'][] = array(
    
"class" => "AppConfigCustomization",
    
"function" => "initialize",
    
"filename" => "AppConfigCustomization.php",
    
"filepath" => "hooks"
); 

in your application/hooks/ folder put a file named AppConfigCustomization.php

PHP Code:
class AppConfigCustomization
{

    private 
$ci;

    public function 
__construct()
    {
        
$this->ci = &get_instance();
    }
    
    
    public function 
initialize()
    {
        if (
$this->ci->session->userdata("is_customer"))
        {
            
$this->config->set_item("cache_path","/location/to/my/install/application/cache2");
        }
    }


something like this is clean and should work
Reply


Messages In This Thread
how to: conditonal config - by starchild - 11-08-2015, 04:08 PM
RE: how to: conditonal config - by sintakonte - 11-09-2015, 05:04 AM
RE: how to: conditonal config - by starchild - 11-09-2015, 05:07 AM
RE: how to: conditonal config - by starchild - 11-11-2015, 08:24 PM
RE: how to: conditonal config - by mwhitney - 11-13-2015, 08:54 AM
RE: how to: conditonal config - by starchild - 11-23-2015, 08:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB