cotonti.com : Module config format https://www.cotonti.com Останні повідомлення в темі Cotonti en Fri, 13 Feb 2026 03:07:29 -0000 Trustmaster Пн, 12 Кві 2010 19:03:04 -0000 Dayver
very simple, clear, concise and very powerful]]>
Сб, 13 Лют 2010 05:00:15 -0000
Sergeich But then the plug-ins to do well]]> Сб, 13 Лют 2010 04:31:27 -0000 Alex300
I think it easy for understand and and the most flexible]]>
Сб, 13 Лют 2010 04:21:05 -0000
Kort Сб, 13 Лют 2010 04:06:19 -0000 esclkm and make plugs in this style!

Добавлено 20 Минут спустя:

I think it is just big - but it easy for understand and there is easy to add land files]]>
Сб, 13 Лют 2010 02:47:14 -0000
Dr2005alex 2) The Seditio way in modulename.setup.php. Very convenient to edit and graphically.]]> Сб, 13 Лют 2010 02:00:56 -0000 Trustmaster
I'm currently considering different formats of declaring the module configuration. The best format is:
  • easy to understand
  • easy to write
  • flexible to store different possible values

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'
	)
);
]]>
Сб, 13 Лют 2010 00:52:42 -0000