object &Config_Container::createItem (
string $type
, mixed $item
, string $content
, array $attributes
= = null
, string $where = 'bottom'
, object $target
= = null
)
このメソッドはセクションに対してコールしなければならず、 作成される項目の型は任意です。これは、新しい子を現在の項目に追加します。 位置を指定した場合は、その場所に子が作成されます。 このメソッドを直接コールするのではなく、ヘルパメソッドを使用することを推奨します。
$type
項目の型。directive
、
section
、comment
、
blank
...
$item
項目名。
$content
項目の内容。
$attributes
項目の属性。
$where
場所を選択します。'bottom'
、
'top'
、'after'
、
'before'
$target
'before'
あるいは
'after'
を
$where
で選んだ場合に必要です。
新しい項目への参照を返します。
エラーコード | エラーの値 | 意味 | 対応 |
---|---|---|---|
" |
This function can not be called statically.
createItem() による新規項目の作成
<?php
$section =& new Config_Container('section', 'conf');
$section->createItem('directive', 'user', 'root');
$section->createItem('directive', 'pass', 'root');
$header =& $section->createItem('comment', null, 'Database Configuration', 'top');
$section->createItem('blank', null, null, 'after', $header);
?>