TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Can I save the config to the file ?
  • Kohana::config_set('config.site_domain', 'http://www.x.com')

    It's just save it in the memory, I want save it to the config.php file, how can i do it ?
    thank you very much ;)
  • Um, change it in the config file?

    In application/config/config.php :

     * Base path of the web site. If this includes a domain, eg: localhost/kohana/
     * then a full URL will be used, eg: http://localhost/kohana/. If it only includes
     * the path, and a site_protocol is specified, the domain will be auto-detected.
    $config['site_domain'] = '/kohana/';

    Note, that like it says, leaving it as a relative path allows it to auto detect your domain name.

  • I mean is there a kohana method that I can save the value to the file. Example: kohana::config_save(), can modify the config file.
  • There's no method to save config values back to a file, you would have to write that yourself. Why would you want to do that anyway?
  • Simply use this traditionnal combo : fopen(), fseek(), fputs(), fclose()
  • You can always use cache (file based), of course with proper expiration time.
  • But I can't write a kohana controller myself like MY_Kohana.php,
    So I must write another class to do Kohana::config_save??
  • You can simply write a helper (http://docs.kohanaphp.com/general/helpers).

    I will repeat after NikcUK - why would you want to do that anyway?
  • I would also like to be able to do this, but it seems it isn't possible without writing the code that actually saves to the config file.
    My reason for doing this is that I want certain configuration variables to be able to be changed by administrative users of the framework.
  • @kavinath: Well you should do that with the Database Config Driver then, not the default Config File Driver. Having your config in a database table makes much more sense in your case.

  • If you really want to edit and save the configuration vars from and to a file. I have written one here.
  • I would assume, writing texts to config file via admin shell.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion