|
Page 1 of 1
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7192
Location: Borgo San Michele
|
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 ACP => Configuration => Icy Phoenix.
- First step create a new empty file into includes/mods_settings and call it as you like (you just need to make sure to have the prefix mod_ in front of it). For the benefit of this tutorial we will call it mod_my_brand_new_config_section.php.
- Fill the file with the config entries you need, these entries will be inserted automatically into phpbb_config 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:
<?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);
?>
- 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 lang_extend_. 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: lang_extend_my_brand_new_lang_file.php. Of course the file have to be located into language/lang_english/ folder!
- The content of the file should be something like this:
<?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...',
)
);
?>
- Now that everything has been created, we are ready to use our own vars everywhere in Icy Phoenix by just using:
- $board_config['my_yes_no_var']
- $board_config['my_text_var']
- Enjoy your new vars!!!
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?
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#1 Sat 12 Sep, 2009 09:40 |
|
Sponsors
|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7192
Location: Borgo San Michele
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
I forgot to mention that you can use the same procedure to add new profile options for users... but that require some extra editing.
If someone is interested I may create extra instructions in the future... if someone would like to try on is own and report the results, is more than welcome.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#2 Sat 12 Sep, 2009 09:54 |
|
Inactive User
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Thank you MG!
I'll be testing this tomorrow to see what I can apply it to.
I hope you've got it right! ROFL!
|
#3 Sat 12 Sep, 2009 10:23 |
|
DWho
Joined: August 2006
Posts: 1307
Location: hampshire
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Fantastic... work around...
I shall be looking at this for future modifications...
____________ Mods and themes for Icy Phoenix 1.3
IcyPhoenix UK is off-line permanently due to lack of time to update mods.
if anyone is interested in my templates I will upgrade them to Icy 2.0.
|
#4 Sun 13 Sep, 2009 16:54 |
|
spydie
Joined: December 2008
Posts: 1796
Location: In the Boxes
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
I forgot to mention that you can use the same procedure to add new profile options for users... but that require some extra editing.
If someone is interested I may create extra instructions in the future... if someone would like to try on is own and report the results, is more than welcome.
Can´t wait to see more instructions. Thank´s MG
____________ Out of Order
|
#5 Sun 13 Sep, 2009 18:29 |
|
Jodi
Joined: February 2009
Posts: 3
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Mighty Gorgon wrote: [View Post] Hi,
I'll make a short example on how you can easily add your own configuration section to ACP => Configuration => Icy Phoenix.
$mod_name = '120_My_Own_Mods';
$lang = array_merge($lang, array(
'120_My_Own_Mods' => 'My Own Mods',
)
Hi,
I'm creating a new simple mod for icy phoenix and i would like to have some parameter to be editable from ACP.
What is unclear to me is the number 120 in the mod's name; i guess it is related to the position of my own configuration section within ACP.
Where can i find any information about it ?
Thanks in advance
|
#6 Sat 14 Nov, 2009 09:44 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7192
Location: Borgo San Michele
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Since currently there is no way to sort ACP modules via DB, sorting is performed alphabetically based on the lang var name.
That number is just an example, you can either remove or change it to suit your needs.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#7 Sun 15 Nov, 2009 11:06 |
|
Jodi
Joined: February 2009
Posts: 3
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Jodi wrote: [View Post]
Hi,
I'm creating a new simple mod for icy phoenix and i would like to have some parameter to be editable from ACP.
What is unclear to me is the number 120 in the mod's name; i guess it is related to the position of my own configuration section within ACP.
Where can i find any information about it ?
Thanks in advance
I posted the message above because my mod settings doesn't appeared in ACP and I guessed it was related to the number 120 in the mod's name.
To insert my mod settings in ACP has been necessary to remove the following lines from first example (file mod_my_brand_new_config_section.php):
$is_allowed = check_acp_module_access();
if ($is_allowed == false)
{
return;
}
Are these lines related to a previous release of icyphoenix ?
I'm using icyphoenix 1.3.0.53
|
#8 Sun 15 Nov, 2009 11:12 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7192
Location: Borgo San Michele
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
As I wrote at the beginning of the post, when you create a module using this way, it will be shown in ACP => Configuration => Icy Phoenix.
Try to check there.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#9 Sun 15 Nov, 2009 11:21 |
|
Jodi
Joined: February 2009
Posts: 3
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Mighty Gorgon wrote: [View Post] As I wrote at the beginning of the post, when you create a module using this way, it will be shown in ACP => Configuration => Icy Phoenix.
Try to check there.
My settings are shown in APC->Configuration->Icy Phoenix only if i comment out/remove the code above.
|
#10 Sun 15 Nov, 2009 11:32 |
|
Mighty Gorgon
Luca Libralato
Joined: August 2006
Posts: 7192
Location: Borgo San Michele
|
Re: ACP - How To Easily Add A Configuration Entry / Value To ACP
Yes, you are right.
Fixed first post.
Thanks
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#11 Sun 15 Nov, 2009 11:53 |
|
|
Page 1 of 1
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
Similar Topics
Similar Topics
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|