Choosing the best one
Trustmaster |
|
---|---|
I'm currently working on modules support in siena/trunk. As you know, each module (e.g. forums) has its own configuration. In Siena it will come with them module either in an SQL file or in modulename.setup.php.
I'm currently considering different formats of declaring the module configuration. The best format is:
Please read these example of configuration options for forums module and tell which you like more and why. Or suggest your own. 1) The plain SQL way in modulename.sql: INSERT INTO `sed_config` (`config_owner`, `config_cat`, `config_order`, `config_name`, `config_type`, `config_value`, `config_default`, `config_variants`, `config_text`) VALUES
('core','forums','01','disable_forums',3,'0','0','',''),
('core','forums','02','hideprivateforums',3,'0','0','',''),
('core','forums','03','hottopictrigger',2,'20','20','5,10,15,20,25,30,35,40,50',''),
('core','forums','04','maxtopicsperpage',2,'30','30','5,10,15,20,25,30,40,50,60,70,100,200,500',''),
('core','forums','05','antibumpforums',3,'0','0','',''),
('core','forums','06','mergeforumposts',3,'1','1','',''),
('core','forums','07','mergetimeout',2,'0','0','0,1,2,3,6,12,24,36,48,72',''),
('core','forums','08','maxpostsperpage',2,'15','15','5,10,15,20,25,30,40,50,60,70,100,200,500',''); 2) The Seditio way in modulename.setup.php: /*
[COT_MODULE_CONFIG]
disable_forums=01:radio::0:
hideprivateforums=02:radio::0:
hottopictrigger=03:select:5,10,15,20,25,30,35,40,50:20:
maxtopicsperpage=04:select:5,10,15,20,25,30,40,50,60,70,100,200,500:30:
antibumpforums=05:radio::0:
mergeforumposts=06:radio::1:
mergetimeout=07:select:0,1,2,3,6,12,24,36,48,72:0:
maxpostsperpage=08:select:5,10,15,20,25,30,40,50,60,70,100,200,500:15:
[/COT_MODULE_CONFIG]
*/ 3) Verbose PHP arrays in modulename.setup.php: $config_options = array(
array(
'name' => 'disable_forums',
'type' => COT_CONFIG_TYPE_RADIO,
'default' => '0'
),
array(
'name' => 'hideprivateforums',
'type' => COT_CONFIG_TYPE_RADIO,
'default' => '0'
),
array(
'name' => 'hottopictrigger',
'type' => COT_CONFIG_TYPE_SELECT,
'default' => '20',
'variants' => '5,10,15,20,25,30,35,40,50'
),
array(
'name' => 'maxtopicsperpage',
'type' => COT_CONFIG_TYPE_SELECT,
'default' => '30',
'variants' => '5,10,15,20,25,30,40,50,60,70,100,200,500'
),
array(
'name' => 'antibumpforums',
'type' => COT_CONFIG_TYPE_RADIO,
'default' => '0'
),
array(
'name' => 'mergeforumposts',
'type' => COT_CONFIG_TYPE_RADIO,
'default' => '1'
),
array(
'name' => 'mergetimeout',
'type' => COT_CONFIG_TYPE_SELECT,
'default' => '0',
'variants' => '0,1,2,3,6,12,24,36,48,72'
),
array(
'name' => 'maxpostsperpage',
'type' => COT_CONFIG_TYPE_SELECT,
'default' => '15',
'variants' => '5,10,15,20,25,30,40,50,60,70,100,200,500'
)
); May the Source be with you!
|