Set config vars c::set (); in a page

Hi there,

I was thinking of a widget (or page) to configure global settings (like those in config.php).

Is it possible to use c::set($key, $value = null) like that?
Like update values/settings with a form?

The reason behind this is, to enable “users” to update settings (like colors in a theme or something) without having to access config.php or connect via FTP to the server.
Making life a bit easier for the web admin. :wink:

No that doesn’t work, cause it wouldn’t be saved anywhere. So on the next page load the values from config.php would be back.

You could think about making these colors and so on site fields and let users update them from the front end. But be aware that this is one user changing it for everyone. If it should be per user, you would need to got for user fields.

Thank you for the fast reply! :smile:

It would not necessarily be saved in the main config.php, since this file is quite essential and must not be compromised.

So it would be easier to create a page and address variables like this:

$var = page('name')->field();

correct?

Well, as I said: If you wanna let a user choose colors, themes or so just for her/him, you should better save it with the user info: http://getkirby.com/docs/cheatsheet/user/update

That’s cool for per user settings, but I wanted to create site-wide settings :wink:

nevertheless, a good hint for user based settings!

I’m a lil struggling in what scenario you would like one front-end user to change theme/color settings for everyone, but in that case take a look at: http://getkirby.com/docs/cheatsheet/site/update

ah, that’s cool.

I could extend the site blueprint with more settings and let the page settings be updated there.

Thanks! :smiley:

And may be you want to use Color Picker Field for Kirby CMS.
I never have tested this.

Good luck!

1 Like

Just came accross this, @HeinerEF :smiley:

It does just this.