api.zedseries.com
[ class tree: Config ] [ index: Config ] [ all elements ]

Class: ZedSeriesIniConfig

Source Location: /ZedSeriesIniConfig.php

Class ZedSeriesIniConfig

Class Overview

Class ZedSeriesIniConfig

an abstract ini based config class

you must override $strDir property in the extended class for this to work

this class allows you to manage ini config file easily
if your ini file looks like:

  1. ;basic_file_ini.ini.php
  2. [section1]
  3. mysetting1 = a
  4. mysetting2 = 42
  5.  
  6. [section2]
  7. mysetting1 = b
  8. mysetting2 = the answer of life universe and everything

you can use the following code to manage its settings
  1. <?php
  2.  
  3. class MyConfig extends ZedSeriesIniConfig {
  4.    protected $strDir='/path/to/ini/file/dir/';
  5.  
  6. $cfg new MyConfig('01_basic_file_ini');
  7. echo $cfg->section1__mysetting1;
  8. // a
  9. echo $cfg->section1__mysetting2;
  10. // 42
  11. print_r($cfg->section2);
  12. /** 
  13.  *Array
  14.  *(
  15.  *  [mysetting1] => b
  16.  *  [mysetting2] => the answer of life universe and everything
  17.  *)
  18. */

i.e. you can always set or read settings using the section__value syntax

Located in /ZedSeriesIniConfig.php [line 38]



		
				Author(s):
		
		
		API Tags:
Abstract:  

Information Tags:
Copyright:  Angelo Galleja 2008,2009,2010

Properties

Methods

[ Top ]
Descendants
Child Class Description
ZedSeriesIniConfigWizard Class ZedSeriesIniConfigWizard

[ Top ]
Property Summary
mixed   $config  
mixed   $strDir   directory containing the config files

[ Top ]
Method Summary
ZedSeriesIniConfig   __construct()   load settings from $fileName and store it internally
mixed   __get()   retrieves a setting by its section name pair
void   __set()   set a setting value through its section__setting name

[ Top ]
Properties
mixed   $config = array() [line 47]
API Tags:
Access:  protected


[ Top ]
mixed   $strDir [line 46]

directory containing the config files

must be relative to TL_ROOT and starts with a slash "/" (i.e /path/to/my/ini/dir)

API Tags:
Access:  protected


Redefined in descendants as:

[ Top ]
Methods
Constructor __construct  [line 56]

  ZedSeriesIniConfig __construct( string $fileName  )

load settings from $fileName and store it internally

Parameters:
string   $fileName:  file name of settings file without extension

API Tags:
Access:  public


[ Top ]
__get  [line 74]

  mixed __get( string $strKey  )

retrieves a setting by its section name pair

Parameters:
string   $strKey:  section__setting name of setting to retrieve (e.g. $obj->section1__name2 for name2 setting of section1), you can also retrieve an array of settings using the $obj->section syntax

API Tags:
Return:  the setting's value, if the setting can't be found an exception will be thrown
Access:  public


[ Top ]
__set  [line 109]

  void __set( string $strKey, mixed $varValue  )

set a setting value through its section__setting name

Parameters:
string   $strKey:  section_setting name of the setting to change
mixed   $varValue:  value to assign to the setting, must be a number or a string

API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 22 Oct 2010 17:37:20 +0200 by phpDocumentor 1.4.1