https://www.icyphoenix.com/viewtopic.php?f=4&t=6459&p=44303#p44303
-----------------------------------
Mighty Gorgon
Sat 12 Sep, 2009 09:40

ACP - How To Easily Add A Configuration Entry / Value To ACP
-----------------------------------
Hi,
I'll make a short example on how you can easily add your own configuration section to [b]ACP => Configuration => Icy Phoenix[/b].

[list=1][*]First step create a new empty file into [b]includes/mods_settings[/b] and call it as you like (you just need to make sure to have the prefix [b]mod_[/b] in front of it). For the benefit of this tutorial we will call it [b]mod_my_brand_new_config_section.php[/b].
[*]Fill the file with the config entries you need, these entries will be inserted automatically into [b]phpbb_config[/b] table (of course table prefix may be different for your own configuration). Here is an example which adds two vars one being YES/NO and the other a TEXT one:
[spoiler][codeblock]<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

if (!defined('IN_ICYPHOENIX'))
{
	die('Hacking attempt');
}

if (!defined('BOARD_CONFIG'))
{
	return;
}

include_once(IP_ROOT_PATH . 'includes/functions_mods_settings.' . PHP_EXT);
$mod_name = '120_My_Own_Mods';

$config_fields = array(

	'my_yes_no_var' => array(
		'lang_key' => 'IP_my_yes_no_var',
		'explain' => 'IP_my_yes_no_var_explain',
		'type' => 'LIST_RADIO',
		'default' => 'No',
		'values' => $list_yes_no,
		),

	'my_text_var' => array(
		'lang_key' => 'IP_my_text_var',
		'explain' => 'IP_my_text_var_explain',
		'type' => 'VARCHAR',
		'default' => 'write here your value',
		),

);

init_board_config($mod_name, $config_fields);

?>[/codeblock][/spoiler]
[*]You will now need to create language entries for all those new vars, and to do that let's create a brand new lang file so to avoid messing with standard Icy Phoenix files. Again the name could be as you like, but you need to pay attention to the prefix which in this case should be [b]lang_extend_[/b]. In this example let's suppose we have only English lang installed (if you have more than one lang you need to replicate this for any lang installed) and we will use this filename: [b]lang_extend_my_brand_new_lang_file.php[/b]. Of course the file have to be located into [b]language/lang_english/[/b] folder!
[*]The content of the file should be something like this:
[spoiler][codeblock]<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*
* @Extra credits for this file
* Lopalong
*
*/

if (!defined('IN_ICYPHOENIX'))
{
	exit;
}

if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

$lang = array_merge($lang, array(
	'120_My_Own_Mods' => 'My Own Mods',
	)
);

// admin part
if ($lang_extend_admin)
{
	$lang = array_merge($lang, array(

		'IP_my_yes_no_var' => 'Enable My Own Var',
		'IP_my_yes_no_var_explain' => 'Enable this option will do nothing! <br /><b>Note:</b> Greetings From MG.',

		'IP_my_text_var' => 'My Text Var',
		'IP_my_text_var_explain' => 'Insert any text you like...',

	)
);

?>
[/codeblock][/spoiler]
[*]Now that everything has been created, we are ready to use our own vars everywhere in Icy Phoenix by just using:
[list][*]$board_config['my_yes_no_var']
[*]$board_config['my_text_var'][/list]
[*]Enjoy your new vars!!![/list]


You have created your own config section and vars without having edited a single Icy Phoenix file, did you expect it could be so easy? :mri:


