Config_Container::addItem

Config_Container::addItem() – Add item to this item.

Synopsis

require_once 'Config/Container.php';

object Config_Container::addItem ( object &$item , string $where = 'bottom' , object $target = null )

Description

This method will add a Config_Container child to the current container children. Thus, addItem() can only be called one a section type container. If a position is specified, the object will be added at this position. If 'before' or 'after' are specified as position, a target object is required. The object will then be added before or after the target object position in the current container.

Parameter

object &$item

a container object

string $where

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

object $target

needed if you choose 'before' or 'after' in $where. $target must be one of this container's children. ZendEngine2 will accept references with default. It will then be possible to have &$target instead.

Return value

object - A reference to the added object

Throws

Possible PEAR_Error values
Error code Error value Meaning Solution
  "    

Note

This function can not be called statically.

Example

Adding an item using addItem()

<?php
$section 
=& new Config_Container('section''conf');
$directive =& new Config_Container('directive''user''mansion');
$section->addItem($directive);
?>

Adding an item using addItem() and a position relative to another item

<?php
$section 
=& new Config_Container('section''conf');
$directive =& new Config_Container('directive''user''mansion');
$section->addItem($directive);

$comment =& new Config_Container('comment'null'Here goes my name');
$section->addItem($comment'before'$directive);
?>
Constructor (Previous) Count children of container (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.