require_once 'Config/Container.php';
array Config_Container::getAttributes (void)
array Config_Container::getAttributes
This method returns an array containing the attributes of this container.
array - item's attributes
This function can not be called statically.
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>