Config_Container::createItem() – Create new child for section item


require_once 'Config/Container.php';

object &Config_Container::createItem ( string $type , mixed $item , string $content , array $attributes = null , string $where = 'bottom' , object $target = null )


This method must be called on a section, the created item can be anything. It adds a new child to the current item. If a position is specified, the child will be created at there. It is recommended to use the helper methods instead of calling this method directly.


string $type

type of item: directive, section, comment, blank...

mixed $item

item name

string $content

item content

array $attributes

item attributes

string $where

choose a position 'bottom', 'top', 'after', 'before'

object $target

needed if you choose 'before' or 'after' for $where

Return value

object - reference to new item


Possible PEAR_Error values
Error code Error value Meaning Solution


This function can not be called statically.


Create some new items using createItem()

=& new Config_Container('section''conf');
$header =& $section->createItem('comment'null'Database Configuration''top');
Add directive to item (Previous) Add section to item (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.