Config_Container::createItem()

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

返り値

object - reference to new item

例外・エラー

表 31-1PEAR_Error の値

Error codeError valueMeaningSolution
 ""  

注意

この関数は、スタティックにコールする ことはできません。

例 31-1Create some new items using 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);
?>