previousConfig_Container::Config_Container (Previous) (Next) Config_Container::countChildrennext

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Config_Container::addItem

Config_Container::addItem() – このアイテムにアイテムを追加する

Synopsis

require_once 'Config/Container.php';

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

Description

このメソッドは現在の子コンテナに子Config_Containerを加えるでしょう。 したがって、addItem() は単に1つのセクションタイプコンテナと呼ぶことができます。 位置が指定されれば、 オブジェクトはこの位置で加えられるでしょう。 もし'before''after' が位置として指定された場合、ターゲットオブジェクトが必要です。 are specified as position, a target object is required. その後、オブジェクトは、 現在のコンテナ中のターゲットオブジェクトの位置の前、 あるいはその位置の後に加えられるでしょう。

Parameter

object &$item

コンテナオブジェクトです。

string $where

一の選択です。('bottom' , 'top' , 'after' , 'before' )

object $target

もし$where で、 'before''after' を選択した場合に必要です。 $target は、 このコンテナの子供のうちのひとつである必要があります。 ZendEngine2は、デフォルトでリファレンスを受け取ります。 その後、 &$target を代わりに持つことは可能でしょう。

Return value

object - 追加されたオブジェクトのリファレンスです。

Throws

Possible PEAR_Error values
エラーコード エラー値 意味 解決
  "    

Note

This function can not be called statically.

Example

addItem()でアイテムを追加する使用例

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

別のアイテムに関連する位置とaddItem()でアイテムを追加する使用例

<?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);
?>
previousConfig_Container::Config_Container (Previous) (Next) Config_Container::countChildrennext

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.