Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16774 программиста и 1774 робота. Сейчас ищут 1297 программистов ...

Config_Container::getItem

Вернуться к: Config_Container class

Config_Container::getItem

Config_Container::getItem() – Tries to find specific items

Synopsis

require_once 'Config/Container.php';

mixed Config_Container::getItem ( string $type = null , string $name = null , mixed $content = null , array $attributes = null , int $index = -1 )

This method tries to find the items that respond to the specified parameters.

This method can only be called on an object of type 'section'. Note that root is a section. This method is not recursive and tries to keep the current structure.

Parameter

string $type

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

string $name

item name

mixed $content

find item with this content

array $attributes

find item with attribute set to the given value

integer $index

index of the item in the returned object list. If it is not set, will try to return the last item with this name.

Return value

mixed - reference to item found or FALSE when not found

Note

This function can not be called statically.

Example

A few examples on how to find items using getItem()

<?php
// will return the last directive found

$directives =& $obj->getItem('directive');

// will return the last directive found with content 'root'

$directives =& $obj->getItem('directive'null'root');

// will return the fourth directive with name 'bar'

$directive_bar_4 =& $obj->getItem('directive''bar'nullnull4);

// will return the last section named 'foo'

$section_foo =& $obj->getItem('section''foo');

// will return the last section with attribute 'id' set to 'db'

$section_foo =& $obj->getItem('section''foo'null, array('id' => 'db'));
?>


Вернуться к: Config_Container class

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware