Creating a package

Permalink
I have just created a block that I'm quite pleased with but there are some things that I don't know how to do and can't really find tuts for.

First thing is that I want to create a package of it which I managed to to, but, I want to have a settings page on the dashboard with one option really. I got the single page there but how do I proceed?
I want to be able to get the option value from my block easily, I also want to be able to edit the value in settings.

is that clear?

should I use db's or something else, Help please.

 
JohntheFish replied on at Permalink Reply
JohntheFish
Most packages use the Config table of the database if there are only a few package wide settings. There is a class to interface to it and more info in the documentation.

http://www.concrete5.org/documentation/developers/system/config-pre...

Your dashboard single page will need a controller and a view. The controller can use the config for storing/retrieving the settings.

Your block controller then read config to find out how it is configured.
slydge replied on at Permalink Reply
Sounds like what I'm looking for, how do I solve it in the controller codevize?
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
$pkg  = Package::getByHandle('my_package_handle');
$pkg->saveConfig('MY_CONFIG_SYMBOL', $data );
$data = $pkg->config('MY_CONFIG_SYMBOL');

(The convention seems to be that config symbols are uppercase)

You can use php serialize/unserialize or json to store more complex data structures.

Use phpMyAdmin to browse the database Config table and get some ideas.