PEAR Manual
Prev |  | Next

# Config_Container::getAttributes()

Config_Container::getAttributes() -- Get item attributes

## Synopsis

    require_once 'Config/Container.php';

``array Config_Container::getAttributes` (void)`

## Description

This method returns an array containing the attributes of this container.

## Return value

`array` - item's attributes

## Note

This function can not be called statically.

## Example

Example 31-1. Using attribute
    $attributes = array('id' => 'db', 'language' => 'en');
         $section =& new Config_Container('section', 'main', null, $attributes);
         $section->createDirective('authentication', 'test', array('type' => 'mysql',
         'host' => 'localhost'));

         echo $section->toString('phparray');
         echo $section->toString('xml');

Example 31-2. Attributes are set for '@' key with php array type
    <?php
    $main['@']['id'] = 'db';
    $main['@']['language'] = 'en';
    $main['authentication']['#'] = 'test';
    $main['authentication']['@']['type'] = 'mysql';
    $main['authentication']['@']['host'] = 'localhost';
    ?>

Example 31-3. Attributes are set the usual way with xml type
    <?xml version="1.0" encoding="ISO-8859-1"?>
           <main id="db" language="en">
            <authentication type="mysql" host="localhost">
             test
            </authentication>;
           </main>

Prev | Home | Next
Config_Container::getAttribute() | Up | Config_Container::getChild()