09-02-2016, 04:12 AM
Not in UserSpice, but in my own app.
My philosophy in starting with UserSpice is that I want to build on the framework that is there to the greatest extent possible (not reinventing the wheel). Thus since you had a config class already in place I just add my config elements to your system.
However, my basic approach to configured elements is to always provide a (hopefully reasonable) default. So I always check if the item exists in the Config file and, if not, I provide this default like this:
What I ran into was that the was returning the whole array and thus instead of a value I was getting an array in my variable.
It's very possible I'm not using Config in the way it was intended - for all my suggestions please take them as just that: suggestions.
I will confess I'm going to have a bear of a time the next time I upgrade UserSpice... :-) But that's on my head - you clearly communicated that I should use the directory...
My philosophy in starting with UserSpice is that I want to build on the framework that is there to the greatest extent possible (not reinventing the wheel). Thus since you had a config class already in place I just add my config elements to your system.
However, my basic approach to configured elements is to always provide a (hopefully reasonable) default. So I always check if the item exists in the Config file and, if not, I provide this default like this:
Code:
$myCfgItem = Config::get('myapp/mycfgitem') ? : 'my default';
What I ran into was that the
Code:
Config::get()
Code:
$config
It's very possible I'm not using Config in the way it was intended - for all my suggestions please take them as just that: suggestions.
I will confess I'm going to have a bear of a time the next time I upgrade UserSpice... :-) But that's on my head - you clearly communicated that I should use the
Code:
usersc