File structure

This file contains configuration data for your plugin. This will enable user to configure plugin settings right in the control panel without having to edit any files. Configuration settings can be of different types such as text, drop down boxes, check boxes, etc.

$config = array(
	'general' => array( // group settings into the 'general' group
		'active' => array(
			'type' => 'boolean', // setting type (boolean will show yes/no)
			'value' => 1 // default value
		'articles_per_page' => array(
			'type' => 'number', // setting type (will ask for a number)
			'value' => 15, // default value
			'required' => 1 // make this setting required
		'rating' => array(
			'type' => 'select', // show drop down box
			'value' => "stars", // default value
			'items' => array( // items to show in the drop down box
				'' => "rating_none",
				'likes' => "rating_likes",
				'stars' => "rating_stars"
		'info_text' => array(
			'type' => 'text', // setting type (text box)
			'class' => 'input-xlarge', // css class
	'comments' => array( // group settings into the 'comments' group
		'comments' => array(
			'type' => 'boolean',
			'value' => 1
		'privacy_comments' => array(
			'type' => 'boolean',
			'value' => 1

Settings are saved into the "core_config" table in the database.

Setting types

Settings can be of different types and include the following:

  • number - basic number value
  • dimensions - width and height values used for images
  • text - any text value
  • textarea - any text value in a text area box
  • boolean - yes/no value
  • select - drop down box
  • radio - radio check boxes
  • checkbox - check boxes

Setting types including "select", "radio" and "checkbox" must include an additional parameter called "items" where you must list items for user to select from (see "rating" setting above).

Accessing settings

You may access your settings in the software like this:

// 'active' is the 'keyword' from the settings above
// 'articles' is the name of the plugin
config::item('active', 'articles');

// another example
config::item('articles_per_page', 'articles');

Language file

Language file "languages/english.php" will contain code like this:

$config = array(
	// General group
	'active' => "Enable articles",
	'articles_per_page' => "Articles per page",
	'rating' => "Article rating",
	'info_text' => "Sample info text",
	// Comments group
	'comments' => "Enable comments",
	'privacy_comments' => "Enable comments privacy",

Note that our setting groupps are not listed in the this language file. This is because when displaying configuration, system looks for language content in the following order:

  • "articles" plugin "config" section (in this example we use "articles" plugin)
  • "articles" plugin global section
  • "system" plugin "config" section
  • "system" plugin global section

Since language items for "general" and "comments" groups already exist in the "system" plugin we don't need to include them again in our "articles" language file. This makes it easy when translating content as we don't have to translate the same text twice.

Same rule applies to the "name" and "items" values in the settings file (in the "select", "radio" and "checkbox" setting types).

If we wanted to include them anyway, we would do this (note the "group_" prefix for setting groups):

$config = array(
	// Groups
	'group_general' => "General settings",
	'group_comments' => "Comment settings",
	// Rating items
	'rating_none' => "None",
	'rating_likes' => "Likes",
	'rating_stars' => "Stars",