|
Revision 39, 1.2 kB
(checked in by mikey, 2 years ago)
|
converted the TestConstructor? example
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
require_once '../XJConf/XJConfLoader.php'; |
|---|
| 9 |
XJConfLoader::load('DefinitionParser', |
|---|
| 10 |
'XmlParser', |
|---|
| 11 |
'ext.Extension' |
|---|
| 12 |
); |
|---|
| 13 |
require 'ConstructorColor.php'; |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
class TestConstructor |
|---|
| 21 |
{ |
|---|
| 22 |
public static function main() |
|---|
| 23 |
{ |
|---|
| 24 |
$tagParser = new DefinitionParser(); |
|---|
| 25 |
$defs = $tagParser->parse(getcwd() . '/xml/defines-constructor.xml'); |
|---|
| 26 |
|
|---|
| 27 |
$conf = new XmlParser(); |
|---|
| 28 |
$conf->setTagDefinitions($defs); |
|---|
| 29 |
|
|---|
| 30 |
try { |
|---|
| 31 |
$conf->parse(getcwd() . '/xml/test-constructor.xml'); |
|---|
| 32 |
} catch (Exception $e) { |
|---|
| 33 |
echo $e->getTraceAsString(); |
|---|
| 34 |
exit(0); |
|---|
| 35 |
} |
|---|
| 36 |
|
|---|
| 37 |
$color = $conf->getConfigValue('color'); |
|---|
| 38 |
var_dump($color); |
|---|
| 39 |
$color = $conf->getConfigValue('color-no-atts'); |
|---|
| 40 |
var_dump($color); |
|---|
| 41 |
$color = $conf->getConfigValue('color2'); |
|---|
| 42 |
var_dump($color); |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
TestConstructor::main(); |
|---|
| 46 |
?> |
|---|